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

Unified Diff: extensions/renderer/extension_frame_helper.h

Issue 2300453002: [Extensions] Begin making Extension port initialization asynchronous (Closed)
Patch Set: Nasko's Created 4 years, 3 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
« no previous file with comments | « extensions/renderer/BUILD.gn ('k') | extensions/renderer/extension_frame_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/extension_frame_helper.h
diff --git a/extensions/renderer/extension_frame_helper.h b/extensions/renderer/extension_frame_helper.h
index 5b30a0d4860ace5057a69b17c1e7b2d51aaa9cb3..da4710a106d3e6290e8f7d93a1b43addc177de90 100644
--- a/extensions/renderer/extension_frame_helper.h
+++ b/extensions/renderer/extension_frame_helper.h
@@ -81,6 +81,13 @@ class ExtensionFrameHelper
// Schedule a callback, to be run at the next RunScriptsAtDocumentEnd call.
void ScheduleAtDocumentEnd(const base::Closure& callback);
+ // Sends a message to the browser requesting a port id. |callback| will be
+ // invoked with the global port id when the browser responds.
+ void RequestPortId(const ExtensionMsg_ExternalConnectionInfo& info,
+ const std::string& channel_name,
+ bool include_tls_channel_id,
+ const base::Callback<void(int)>& callback);
+
private:
// RenderFrameObserver implementation.
void DidCreateDocumentElement() override;
@@ -121,6 +128,7 @@ class ExtensionFrameHelper
const std::string& function_name,
const base::ListValue& args,
bool user_gesture);
+ void OnAssignPortId(int port_id, int request_id);
// Type of view associated with the RenderFrame.
ViewType view_type_;
@@ -142,6 +150,12 @@ class ExtensionFrameHelper
// Callbacks to be run at the next RunScriptsAtDocumentEnd notification.
std::vector<base::Closure> document_load_finished_callbacks_;
+ // Counter for port requests.
+ int next_port_request_id_;
+
+ // Map of port requests to callbacks.
+ std::map<int, base::Callback<void(int)>> pending_port_requests_;
+
base::WeakPtrFactory<ExtensionFrameHelper> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper);
« no previous file with comments | « extensions/renderer/BUILD.gn ('k') | extensions/renderer/extension_frame_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698