Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify PerformanceObserver registration language in the spec #44

Closed
igrigorik opened this issue Aug 12, 2015 · 16 comments
Closed

Clarify PerformanceObserver registration language in the spec #44

igrigorik opened this issue Aug 12, 2015 · 16 comments

Comments

@igrigorik
Copy link
Member

Continuation of #43. In particular, this language:

Otherwise, register the performance observer as an observer with the options as options on the Performance Timeline visible from the performance observer's context.

Related: #40 (comment), #43 (comment), and https://www.w3.org/Bugs/Public/show_bug.cgi?id=24652.

@annevk @bzbarsky would appreciate any tips on how to spec this.. unclear on the plumbing.

@bzbarsky
Copy link

So we're doing new PerformanceObserver right? What you presumably want is to get the global associated with that constructor (the global of the Realm of the function is what I think you want here) and then go from that global to the preformance timeline; how that last part works would be defined by whatever spec defines the performance timeline.

The Web IDL spec does talk about "the ECMAScript global environment associated with the interface object" so you could use that language too; we'd then define it carefully in the IDL spec.

@igrigorik
Copy link
Member Author

@bzbarsky @mpb took a slightly different route (modeled on Mutation Observer) in #47. PTAL.

@annevk
Copy link
Member

annevk commented Sep 16, 2015

Why is that a good model here? Mutation observers have to deal with nodes moving between globals, is that relevant for performance timelines?

@igrigorik
Copy link
Member Author

@annevk err, sorry that was poor wording on my part. By "modeled" I simply meant that it uses similar approach to keep track of registered observers.. ptal at the language in #47.

@annevk
Copy link
Member

annevk commented Sep 16, 2015

Right, I did. I'm wondering why you went with "unit of related similar-origin browsing contexts" rather than scoping it to a global as @bzbarsky suggested.

@igrigorik
Copy link
Member Author

Perhaps not the best one: perf observer processing was already using that language.

Each [ECMAScript global environment][] has a performance observer task queued flag and an associated list of registered performance observer objects which is initially empty.
...
Let notify list be a copy of [ECMAScript global environment][]'s list of registered performance observer objects.
...
If the list of registered performance observer objects of the [the ECMAScript global environment associated with the interface object][] contains a registered performance observer...

Does that sound about right?

@annevk
Copy link
Member

annevk commented Sep 17, 2015

Yeah, modulo that HTML calls it "JavaScript global environment" or "environment settings object". Ugh, we should really figure out some consistent wording. @bzbarsky should probably sign off though, he knows this better.

@bzbarsky
Copy link

Yes, we need to figure out consistent wording. We have "JavaScript global environment" (HTML), "Realm" (ES6), "ECMAScript global environment" (WebIDL). These may or may not all be the same thing, but I think in practice they are. Also, "environment settings object" is claimed by hixie to be subtly different from just "a global", but I have never quite understood what the difference is, and it's not spelled out anywhere.

Which is to say, that I have no clue what to call this thing, or even what "this thing" is, offhand. :(

@annevk
Copy link
Member

annevk commented Sep 17, 2015

The difference between "environment settings object" and "global" is I think that the former is language-neutral. I'm not sure how strongly we need to care about that though.

@bzbarsky
Copy link

I seem to recall hixie claiming that the relationship between environment settings objects and globals was not 1-1...

@igrigorik
Copy link
Member Author

Hmm, so what's the verdict here? Should I go with the WebIDL version? :)

@igrigorik
Copy link
Member Author

@annevk should I block this on whatwg/html#167? Can't tell which way you're intending to head in that one.

@annevk
Copy link
Member

annevk commented Sep 22, 2015

I think going with either the IDL version or what is in HTML today is probably fine for a MVP. We can revisit once cleanup has happened.

@igrigorik
Copy link
Member Author

@annevk @bzbarsky updated. not 100% on it, but I think this should be pretty close: #47 - wdyt?

@annevk
Copy link
Member

annevk commented Sep 23, 2015

Looks okay. Probably also want to ask feedback on [email protected] for the design of the API.

@igrigorik
Copy link
Member Author

@annevk thanks, I'll land this then and we can iterate from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants