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

Side by Side Diff: extensions/renderer/extension_frame_helper.cc

Issue 2481413004: [Extensions] Make port creation synchronous in unload handlers (Closed)
Patch Set: Ilya's Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « extensions/renderer/extension_frame_helper.h ('k') | extensions/renderer/messaging_bindings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/renderer/extension_frame_helper.h" 5 #include "extensions/renderer/extension_frame_helper.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/timer/elapsed_timer.h" 9 #include "base/timer/elapsed_timer.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 pending_port_requests_[port_request_id] = 234 pending_port_requests_[port_request_id] =
235 base::MakeUnique<PendingPortRequest>(PortType::NATIVE_APP, callback); 235 base::MakeUnique<PendingPortRequest>(PortType::NATIVE_APP, callback);
236 { 236 {
237 SCOPED_UMA_HISTOGRAM_TIMER( 237 SCOPED_UMA_HISTOGRAM_TIMER(
238 "Extensions.Messaging.GetPortIdSyncTime.NativeApp"); 238 "Extensions.Messaging.GetPortIdSyncTime.NativeApp");
239 render_frame()->Send(new ExtensionHostMsg_OpenChannelToNativeApp( 239 render_frame()->Send(new ExtensionHostMsg_OpenChannelToNativeApp(
240 render_frame()->GetRoutingID(), native_app_name, port_request_id)); 240 render_frame()->GetRoutingID(), native_app_name, port_request_id));
241 } 241 }
242 } 242 }
243 243
244 int ExtensionFrameHelper::RequestSyncPortId(
245 const ExtensionMsg_ExternalConnectionInfo& info,
246 const std::string& channel_name,
247 bool include_tls_channel_id) {
248 int port_id = 0;
249 render_frame()->Send(new ExtensionHostMsg_OpenChannelToExtensionSync(
250 render_frame()->GetRoutingID(), info, channel_name,
251 include_tls_channel_id, &port_id));
252 return port_id;
253 }
254
244 void ExtensionFrameHelper::DidMatchCSS( 255 void ExtensionFrameHelper::DidMatchCSS(
245 const blink::WebVector<blink::WebString>& newly_matching_selectors, 256 const blink::WebVector<blink::WebString>& newly_matching_selectors,
246 const blink::WebVector<blink::WebString>& stopped_matching_selectors) { 257 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
247 extension_dispatcher_->content_watcher()->DidMatchCSS( 258 extension_dispatcher_->content_watcher()->DidMatchCSS(
248 render_frame()->GetWebFrame(), newly_matching_selectors, 259 render_frame()->GetWebFrame(), newly_matching_selectors,
249 stopped_matching_selectors); 260 stopped_matching_selectors);
250 } 261 }
251 262
252 void ExtensionFrameHelper::DidStartProvisionalLoad() { 263 void ExtensionFrameHelper::DidStartProvisionalLoad() {
253 if (!delayed_main_world_script_initialization_) 264 if (!delayed_main_world_script_initialization_)
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 420 }
410 request.callback.Run(port_id); 421 request.callback.Run(port_id);
411 pending_port_requests_.erase(iter); 422 pending_port_requests_.erase(iter);
412 } 423 }
413 424
414 void ExtensionFrameHelper::OnDestruct() { 425 void ExtensionFrameHelper::OnDestruct() {
415 delete this; 426 delete this;
416 } 427 }
417 428
418 } // namespace extensions 429 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/extension_frame_helper.h ('k') | extensions/renderer/messaging_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698