Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Issue 1609343002: Move hasPendingActivity from ActiveDOMObject to ScriptWrappable (Closed)

Created:
4 years, 11 months ago by haraken
Modified:
4 years, 10 months ago
Reviewers:
kinuko, vivekg, Ilya Sherman
CC:
chromium-reviews, kinuko+worker_chromium.org, philipj_slow, feature-media-reviews_chromium.org, mlamouri+watch-blink_chromium.org, sof, eae+blinkwatch, eric.carlson_apple.com, falken, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews-bindings_chromium.org, blink-reviews, horo+watch_chromium.org, blink-worker-reviews_chromium.org, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move hasPendingActivity from ActiveDOMObject to ScriptWrappable Currently hasPendingActivity is a method of ActiveDOMObject (by accident), so a lot of objects need to become ActiveDOMObject just to override hasPendingActivity. This is not nice in terms of both design and performance. - In terms of design, ActiveDOMObject is an object whose lifetime is tied with ExecutionContext. On the other hand, hasPendingActivity is a mechanism to keep alive a wrapper while the underlying DOM object has some pending activities. These two are totally different notions. - In terms of performance, ActiveDOMObjects are heavy because they must be observed by LifecycleObservers and notified when the observing context changes its lifetime state. It's not nice to increase the number of ActiveDOMObjects. Given the above, this CL moves hasPendingActivity from ActiveDOMObject to ScriptWrappable. The most tricky part is how to detect the fact that all pending activities of a worker are gone. Before this CL, this was detected by scanning a list of ActiveDOMObjects and checking their pending activities when the main thread posts a message to the worker. After this CL, it is detected by scanning a list of ScriptWrappables and checking their pending activities. Given that the number of ScriptWrappables is larger than the number of ActiveDOMObjects, this CL will increase the overhead of scanning at every postMessage. I don't know how large the overhead is, but I hope that the number of ScriptWrappables in workers is limited in common cases and thus the overhead wouldn't be an issue. This CL passes all tests in fast/workers, in particular the following tests: - worker-messageport-gc.html (which checks that a worker that has a pending timer task doesn't get garbage-collected) - dedicated-worker-lifecycle.html (which checks that a worker that doesn't have any pending activity is garbage-collected in a finite time period) BUG=483722 TEST=fast/workers/ Committed: https://crrev.com/485c63ccd15b1e6efe6baf67010da6ea2db94e0d Cr-Commit-Position: refs/heads/master@{#374584}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 5

Patch Set 4 : #

Total comments: 3

Patch Set 5 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+87 lines, -33 lines) Patch
M third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8GCController.h View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp View 1 2 3 4 5 chunks +64 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ActiveDOMObject.h View 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ActiveDOMObject.cpp View 1 chunk +0 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.h View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp View 1 chunk +0 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (9 generated)
haraken
kinuko-san: Would you take a quick look at this CL? If the approach looks okay, ...
4 years, 11 months ago (2016-01-22 17:15:44 UTC) #3
kinuko
As this doesn't seem to change the existing policy of how it triggers GC it ...
4 years, 11 months ago (2016-01-25 04:06:25 UTC) #4
haraken
https://codereview.chromium.org/1609343002/diff/40001/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp File third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp (right): https://codereview.chromium.org/1609343002/diff/40001/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp#newcode468 third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp:468: { On 2016/01/25 04:06:25, kinuko wrote: > Could we ...
4 years, 11 months ago (2016-01-25 04:08:42 UTC) #5
haraken
kinuko-san: PTAL On 2016/01/25 04:08:42, haraken wrote: > https://codereview.chromium.org/1609343002/diff/40001/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp > File third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp (right): > > ...
4 years, 10 months ago (2016-02-08 05:42:45 UTC) #6
haraken
kinuko-san: friendly ping?
4 years, 10 months ago (2016-02-09 00:05:00 UTC) #7
kinuko
LGTM, sorry for slow response
4 years, 10 months ago (2016-02-09 02:23:19 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1609343002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1609343002/60001
4 years, 10 months ago (2016-02-09 03:27:36 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/144069)
4 years, 10 months ago (2016-02-09 03:41:50 UTC) #12
haraken
isherman@: PTAL at histogram.xml.
4 years, 10 months ago (2016-02-09 04:06:45 UTC) #14
Ilya Sherman
https://codereview.chromium.org/1609343002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp File third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp (right): https://codereview.chromium.org/1609343002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp#newcode519 third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp:519: scanPendingActivityHistogram.count(WTF::currentTimeMS() - startTime); Hrm, you seem to be passing ...
4 years, 10 months ago (2016-02-09 22:07:00 UTC) #15
haraken
On 2016/02/09 22:07:00, Ilya Sherman wrote: > https://codereview.chromium.org/1609343002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp > File third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp (right): > > https://codereview.chromium.org/1609343002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp#newcode519 ...
4 years, 10 months ago (2016-02-09 23:59:00 UTC) #16
Ilya Sherman
Histograms lgtm.
4 years, 10 months ago (2016-02-10 00:53:13 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1609343002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1609343002/80001
4 years, 10 months ago (2016-02-10 00:58:52 UTC) #20
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 10 months ago (2016-02-10 02:49:48 UTC) #22
commit-bot: I haz the power
4 years, 10 months ago (2016-02-10 02:51:06 UTC) #24
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/485c63ccd15b1e6efe6baf67010da6ea2db94e0d
Cr-Commit-Position: refs/heads/master@{#374584}

Powered by Google App Engine
This is Rietveld 408576698