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

Issue 2481413004: [Extensions] Make port creation synchronous in unload handlers (Closed)

Created:
4 years, 1 month ago by Devlin
Modified:
4 years, 1 month ago
CC:
chromium-reviews, extensions-reviews_chromium.org, dglazkov+blink, asvitkine+watch_chromium.org, blink-reviews, chromium-apps-reviews_chromium.org, kinuko+watch, blink-reviews-api_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Extensions] Make port creation synchronous in unload handlers https://crrev.com/dbbe69e7a03b50940d5b7e615c04de531511cac3 made extension message port initialization asynchronous in order to address performance concerns around having a synchronous IPC. Unfortunatley, this broke use cases where extensions use chrome.runtime.sendMessage() from the unload handler for a page. Fix this by using synchronous port creation in this case only. This is essentially a partial revert of the above patch, but still leaves us in a much better state than when all ports were created synchronously (especially since we know no ports are created synchronously during page load). In the long run, this is something we want to discourage, but that should be done deliberately, and the original CL wasn't meant to break anything. Add a test to ensure we don't regress in the future. Also add metrics for tracking the number of ports created during unload handlers so that we can determine how common of an occurrence this is, which can influence our decisions going forward. BUG=660706 Committed: https://crrev.com/69424807aa1ee34516783d9dd206a95e9f034e33 Cr-Commit-Position: refs/heads/master@{#431925}

Patch Set 1 #

Patch Set 2 : woot #

Patch Set 3 : polish #

Total comments: 6

Patch Set 4 : Add DoNotUse warnings #

Total comments: 5

Patch Set 5 : Ilya's #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -8 lines) Patch
M chrome/browser/extensions/extension_messages_apitest.cc View 1 2 3 chunks +41 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/chrome_extension_message_filter.h View 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/chrome_extension_message_filter.cc View 2 chunks +22 lines, -3 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/on_unload/content_script.js View 1 1 chunk +9 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/on_unload/manifest.json View 1 chunk +14 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/on_unload/test.js View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
M extensions/common/extension_messages.h View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M extensions/renderer/extension_frame_helper.h View 1 chunk +3 lines, -0 lines 0 comments Download
M extensions/renderer/extension_frame_helper.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M extensions/renderer/messaging_bindings.h View 1 2 3 1 chunk +11 lines, -1 line 0 comments Download
M extensions/renderer/messaging_bindings.cc View 1 2 3 4 2 chunks +36 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/web/WebDocument.cpp View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/public/web/WebDocument.h View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 2 chunks +23 lines, -0 lines 0 comments Download

Messages

Total messages: 37 (22 generated)
Devlin
dcheng@ and lazyboy@, mind taking a look? This is basically a targeted revert of https://crrev.com/dbbe69e7a03b50940d5b7e615c04de531511cac3 ...
4 years, 1 month ago (2016-11-10 01:02:28 UTC) #11
lazyboy
extensions lgtm /w nits. https://codereview.chromium.org/2481413004/diff/40001/extensions/renderer/messaging_bindings.h File extensions/renderer/messaging_bindings.h (right): https://codereview.chromium.org/2481413004/diff/40001/extensions/renderer/messaging_bindings.h#newcode121 extensions/renderer/messaging_bindings.h:121: int ports_created_in_before_unload_ = 0; since ...
4 years, 1 month ago (2016-11-11 01:39:17 UTC) #12
dcheng
I really don't want to expose the unload event state outside of Blink. =/ Are ...
4 years, 1 month ago (2016-11-11 08:27:46 UTC) #13
Devlin
On 2016/11/11 08:27:46, dcheng wrote: > I really don't want to expose the unload event ...
4 years, 1 month ago (2016-11-11 15:33:44 UTC) #14
dcheng
On 2016/11/11 15:33:44, Devlin (slow) wrote: > On 2016/11/11 08:27:46, dcheng wrote: > > I ...
4 years, 1 month ago (2016-11-11 22:28:09 UTC) #15
Devlin
https://codereview.chromium.org/2481413004/diff/40001/extensions/renderer/messaging_bindings.h File extensions/renderer/messaging_bindings.h (right): https://codereview.chromium.org/2481413004/diff/40001/extensions/renderer/messaging_bindings.h#newcode121 extensions/renderer/messaging_bindings.h:121: int ports_created_in_before_unload_ = 0; On 2016/11/11 01:39:17, lazyboy wrote: ...
4 years, 1 month ago (2016-11-12 01:24:30 UTC) #20
Devlin
On 2016/11/11 22:28:09, dcheng wrote: > On 2016/11/11 15:33:44, Devlin (slow) wrote: > > On ...
4 years, 1 month ago (2016-11-12 01:24:45 UTC) #21
Devlin
Also +isherman@ for histograms.
4 years, 1 month ago (2016-11-12 02:45:25 UTC) #23
dcheng
lgtm, thanks
4 years, 1 month ago (2016-11-12 03:33:13 UTC) #24
Ilya Sherman
Metrics LGTM % comments: https://codereview.chromium.org/2481413004/diff/60001/extensions/renderer/messaging_bindings.cc File extensions/renderer/messaging_bindings.cc (right): https://codereview.chromium.org/2481413004/diff/60001/extensions/renderer/messaging_bindings.cc#newcode273 extensions/renderer/messaging_bindings.cc:273: ports_created_in_unload_ > 0) { I ...
4 years, 1 month ago (2016-11-14 18:00:28 UTC) #25
Devlin
https://codereview.chromium.org/2481413004/diff/60001/extensions/renderer/messaging_bindings.cc File extensions/renderer/messaging_bindings.cc (right): https://codereview.chromium.org/2481413004/diff/60001/extensions/renderer/messaging_bindings.cc#newcode273 extensions/renderer/messaging_bindings.cc:273: ports_created_in_unload_ > 0) { On 2016/11/14 18:00:28, Ilya Sherman ...
4 years, 1 month ago (2016-11-14 18:50:34 UTC) #27
Ilya Sherman
(metrics still lgtm, thanks) https://codereview.chromium.org/2481413004/diff/60001/extensions/renderer/messaging_bindings.cc File extensions/renderer/messaging_bindings.cc (right): https://codereview.chromium.org/2481413004/diff/60001/extensions/renderer/messaging_bindings.cc#newcode273 extensions/renderer/messaging_bindings.cc:273: ports_created_in_unload_ > 0) { On ...
4 years, 1 month ago (2016-11-14 19:00:44 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2481413004/80001
4 years, 1 month ago (2016-11-14 20:01:02 UTC) #33
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 1 month ago (2016-11-14 22:42:35 UTC) #35
commit-bot: I haz the power
4 years, 1 month ago (2016-11-14 22:58:52 UTC) #37
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/69424807aa1ee34516783d9dd206a95e9f034e33
Cr-Commit-Position: refs/heads/master@{#431925}

Powered by Google App Engine
This is Rietveld 408576698