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

Unified Diff: extensions/renderer/extension_frame_helper.cc

Issue 2331263002: [Extensions] Finish making port creation asynchronous (Closed)
Patch Set: 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
Index: extensions/renderer/extension_frame_helper.cc
diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc
index 01ee2314dfbf82c8384229ae3f35ec6836c3b7b0..778443aba7f350cdd2edd8233372d8f81743020a 100644
--- a/extensions/renderer/extension_frame_helper.cc
+++ b/extensions/renderer/extension_frame_helper.cc
@@ -190,6 +190,35 @@ void ExtensionFrameHelper::RequestPortId(
}
}
+void ExtensionFrameHelper::RequestTabPortId(
+ const ExtensionMsg_TabTargetConnectionInfo& info,
+ const std::string& extension_id,
+ const std::string& channel_name,
+ const base::Callback<void(int)>& callback) {
+ int port_request_id = next_port_request_id_++;
+ pending_port_requests_[port_request_id] = callback;
+ {
+ SCOPED_UMA_HISTOGRAM_TIMER("Extensions.Messaging.GetPortIdSyncTime.Tab");
+ render_frame()->Send(new ExtensionHostMsg_OpenChannelToTab(
+ render_frame()->GetRoutingID(), info, extension_id, channel_name,
+ port_request_id));
+ }
+}
+
+void ExtensionFrameHelper::RequestNativePortId(
lazyboy 2016/09/13 00:34:39 nit: RequestNativeAppPortId
Devlin 2016/09/13 16:49:55 Done.
+ const std::string& native_app_name,
+ const base::Callback<void(int)>& callback) {
+ int port_request_id = next_port_request_id_++;
+ pending_port_requests_[port_request_id] = callback;
+ {
+ SCOPED_UMA_HISTOGRAM_TIMER(
+ "Extensions.Messaging.GetPortIdSyncTime.NativeApp");
+ // TODO(devlin): Make this async. crbug.com/642380
lazyboy 2016/09/13 00:34:39 Remove.
Devlin 2016/09/13 16:49:55 Whoops, done.
+ render_frame()->Send(new ExtensionHostMsg_OpenChannelToNativeApp(
+ render_frame()->GetRoutingID(), native_app_name, port_request_id));
+ }
+}
+
void ExtensionFrameHelper::DidMatchCSS(
const blink::WebVector<blink::WebString>& newly_matching_selectors,
const blink::WebVector<blink::WebString>& stopped_matching_selectors) {

Powered by Google App Engine
This is Rietveld 408576698