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

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

Issue 2514523002: [Extensions] Make port creation synchronous in unload handlers (Closed)
Patch Set: 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::DidCreateScriptContext( 263 void ExtensionFrameHelper::DidCreateScriptContext(
253 v8::Local<v8::Context> context, 264 v8::Local<v8::Context> context,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 395 }
385 request.callback.Run(port_id); 396 request.callback.Run(port_id);
386 pending_port_requests_.erase(iter); 397 pending_port_requests_.erase(iter);
387 } 398 }
388 399
389 void ExtensionFrameHelper::OnDestruct() { 400 void ExtensionFrameHelper::OnDestruct() {
390 delete this; 401 delete this;
391 } 402 }
392 403
393 } // namespace extensions 404 } // 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