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

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

Created:
4 years, 1 month ago by Devlin
Modified:
4 years, 1 month ago
Reviewers:
CC:
chromium-reviews
Target Ref:
refs/pending/branch-heads/2883
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 Review-Url: https://codereview.chromium.org/2481413004 Cr-Commit-Position: refs/heads/master@{#431925} (cherry picked from commit 69424807aa1ee34516783d9dd206a95e9f034e33) Committed: https://chromium.googlesource.com/chromium/src/+/04e0af8f5c97dc8e0ca69a9da5324ce9f84f950a

Patch Set 1 #

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 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 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 chunk +10 lines, -0 lines 0 comments Download
M extensions/common/extension_messages.h View 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 chunk +11 lines, -1 line 0 comments Download
M extensions/renderer/messaging_bindings.cc View 2 chunks +36 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/web/WebDocument.cpp View 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/public/web/WebDocument.h View 1 chunk +6 lines, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 2 chunks +23 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (1 generated)
Devlin
4 years, 1 month ago (2016-11-17 20:10:56 UTC) #2
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
04e0af8f5c97dc8e0ca69a9da5324ce9f84f950a.

Powered by Google App Engine
This is Rietveld 408576698