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

Unified Diff: chrome/browser/extensions/api/messaging/extension_message_port.h

Issue 1966283002: Remove port lifetime management from renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify: Assume that opener port is open, only send reply if closed Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/messaging/extension_message_port.h
diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.h b/chrome/browser/extensions/api/messaging/extension_message_port.h
index dd6e584fc5ef842cd18a8e4161cb1b2950516c6e..d1dd08c2c0f808a8a6cd16707b2e1b5abc5775fb 100644
--- a/chrome/browser/extensions/api/messaging/extension_message_port.h
+++ b/chrome/browser/extensions/api/messaging/extension_message_port.h
@@ -41,6 +41,11 @@ class ExtensionMessagePort : public MessageService::MessagePort {
content::RenderProcessHost* extension_process);
~ExtensionMessagePort() override;
+ // Check whether the port exists in the frames. Frames that don't know about
Devlin 2016/05/17 19:50:29 nitty nit: descriptive rather than imperative func
Devlin 2016/05/17 19:50:29 Specify "the frames"
robwu 2016/05/17 22:47:50 Done 2x.
+ // the port are removed from the set of frames. This should be used for opener
+ // ports because the frame may be navigated before the port was initialized.
+ void RevalidatePort();
+
// MessageService::MessagePort:
void RemoveCommonFrames(const MessagePort& port) override;
bool HasFrame(content::RenderFrameHost* rfh) const override;
@@ -92,6 +97,11 @@ class ExtensionMessagePort : public MessageService::MessagePort {
// when the frame is removed or unloaded.
std::set<content::RenderFrameHost*> frames_;
+ // The ID of the tab where the channel was created. This is saved so that any
+ // onMessage events can be run in the scope of the tab.
+ // Only set on receiver ports (if the opener was a tab).
Devlin 2016/05/17 19:50:29 Specify that this is -1 if invalid (pretty common,
robwu 2016/05/17 22:47:50 Done.
+ int opener_tab_id_;
+
// Whether the renderer acknowledged creation of the port. This is used to
// distinguish abnormal port closure (e.g. no receivers) from explicit port
// closure (e.g. by the port.disconnect() JavaScript method in the renderer).

Powered by Google App Engine
This is Rietveld 408576698