Closed Bug 1197003 Opened 9 years ago Closed 9 years ago

Implement processing algorithm for PerformanceObserver to notify a batch of entries

Categories

(Core :: DOM: Core & HTML, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: hiro, Assigned: hiro)

References

(Blocks 1 open bug, )

Details

Attachments

(2 files, 4 obsolete files)

https://github.com/w3c/performance-timeline/pull/46 The spec change is still in discussion though.
Blocks: 1158032
Attached patch WIP (obsolete) — Splinter Review
All tests has been rewritten with promise_test[1] because all tests need to be run sequentially to avoid being mixed of user timing entries. [1] https://github.com/w3c/testharness.js/commit/cf0b67dff57c3140c882b1ffd2b5f4c7adc2ba44
I realized that Disconnect() should be called before mPerformance is destroyed in case of the reference of the mPerformance is the last one.
Assignee: nobody → hiikezoe
Attachment #8652556 - Flags: review?(amarchesini)
The previous patch (attachment 8650776 [details] [diff] [review]) did not work on worker threads. I did not know that nsCancelableRunnable is needed for worker threads. Changes for test parts needs promise_test[1] to run each test sequentially. sequential promise_test has been already merged in mozilla-central[2]. [1] https://github.com/w3c/testharness.js/commit/cf0b67dff57c3140c882b1ffd2b5f4c7adc2ba44 [2] https://hg.mozilla.org/mozilla-central/rev/4c5c368b1adf
Attachment #8650776 - Attachment is obsolete: true
Attachment #8652559 - Flags: review?(amarchesini)
Blocks: 1198548
Comment on attachment 8652556 [details] [diff] [review] Part 1: PerformanceObserver::Disconenct() should be called before mPerformance is destroyed. Review of attachment 8652556 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/base/PerformanceObserver.cpp @@ -54,5 @@ > } > > PerformanceObserver::~PerformanceObserver() > { > - Disconnect(); I would not remove this. Keep this too if Disconnect() has: if (!mConnected) { return.. or something similar.
Attachment #8652556 - Flags: review?(amarchesini) → review+
Addressed comment#5. Carrying over review+. Thanks Andrea!
Attachment #8652556 - Attachment is obsolete: true
Attachment #8653989 - Flags: review+
Comment on attachment 8652559 [details] [diff] [review] Part 2: Implement processing algorithm for PerformanceObserver to notify a batch of entries Review of attachment 8652559 [details] [diff] [review]: ----------------------------------------------------------------- Interdiff for this small issue? ::: dom/base/nsPerformance.cpp @@ +1111,5 @@ > + NS_IMETHOD Run() override > + { > + mPerformance->NotifyObservers(); > + return NS_OK; > + } NS_IMETHOD Cancel() override { We should inform mPerformance that this task has been canceled. } @@ +1126,5 @@ > +PerformanceBase::RunNotificationObserversTask() > +{ > + mPendingNotificationObserversTask = true; > + nsCOMPtr<nsIRunnable> task = new NotifyObserversTask(this); > + NS_DispatchToCurrentThread(task); This can fail. Do: nsresult rv = NS_DispatchToCurrentThread(task); if (NS_WARN_IF(NS_FAILED(rv))) { mPendingNotificationObserversTask = false; }
Attachment #8652559 - Flags: review?(amarchesini)
Attached patch Cancel notification to observers (obsolete) — Splinter Review
This is the diff to address comment#7. Thanks!
Attachment #8655850 - Flags: review?(amarchesini)
Comment on attachment 8655850 [details] [diff] [review] Cancel notification to observers Review of attachment 8655850 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/base/nsPerformance.cpp @@ +1110,5 @@ > { > public: > explicit NotifyObserversTask(PerformanceBase* aPerformance) > : mPerformance(aPerformance) > { MOZ_ASSERT(mPerformance); @@ +1114,5 @@ > { > } > > NS_IMETHOD Run() override > { MOZ_ASSERT(mPerformance); @@ +1121,5 @@ > } > > + NS_IMETHOD Cancel() override > + { > + mPerformance->CancelNotificationObservers(); mPerformance = nullptr;
Attachment #8655850 - Flags: review?(amarchesini) → review+
Carrying over review+. Unified attachment #8655850 [details] [diff] [review].
Attachment #8652559 - Attachment is obsolete: true
Attachment #8655850 - Attachment is obsolete: true
Attachment #8656415 - Flags: review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: