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

Side by Side Diff: content/child/navigator_connect/navigator_connect_provider.cc

Issue 810953007: Make use of blink::WebNavigatorConnectCallbacks typedef (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « content/child/navigator_connect/navigator_connect_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/navigator_connect/navigator_connect_provider.h" 5 #include "content/child/navigator_connect/navigator_connect_provider.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "content/child/thread_safe_sender.h" 10 #include "content/child/thread_safe_sender.h"
11 #include "content/child/webmessageportchannel_impl.h" 11 #include "content/child/webmessageportchannel_impl.h"
12 #include "content/common/navigator_connect_messages.h" 12 #include "content/common/navigator_connect_messages.h"
13 #include "content/common/navigator_connect_types.h" 13 #include "content/common/navigator_connect_types.h"
14 #include "third_party/WebKit/public/platform/WebCallbacks.h"
15 #include "third_party/WebKit/public/platform/WebURL.h" 14 #include "third_party/WebKit/public/platform/WebURL.h"
16 15
17 namespace content { 16 namespace content {
18 17
19 namespace { 18 namespace {
20 19
21 base::LazyInstance<base::ThreadLocalPointer<NavigatorConnectProvider>>::Leaky 20 base::LazyInstance<base::ThreadLocalPointer<NavigatorConnectProvider>>::Leaky
22 g_provider_tls = LAZY_INSTANCE_INITIALIZER; 21 g_provider_tls = LAZY_INSTANCE_INITIALIZER;
23 22
24 NavigatorConnectProvider* const kHasBeenDeleted = 23 NavigatorConnectProvider* const kHasBeenDeleted =
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 59 }
61 60
62 NavigatorConnectProvider::~NavigatorConnectProvider() { 61 NavigatorConnectProvider::~NavigatorConnectProvider() {
63 g_provider_tls.Pointer()->Set(kHasBeenDeleted); 62 g_provider_tls.Pointer()->Set(kHasBeenDeleted);
64 } 63 }
65 64
66 void NavigatorConnectProvider::connect( 65 void NavigatorConnectProvider::connect(
67 const blink::WebURL& target_url, 66 const blink::WebURL& target_url,
68 const blink::WebString& origin, 67 const blink::WebString& origin,
69 blink::WebMessagePortChannel* port, 68 blink::WebMessagePortChannel* port,
70 blink::WebCallbacks<void, void>* callbacks) { 69 blink::WebNavigatorConnectCallbacks* callbacks) {
71 int request_id = requests_.Add(callbacks); 70 int request_id = requests_.Add(callbacks);
72 71
73 WebMessagePortChannelImpl* webchannel = 72 WebMessagePortChannelImpl* webchannel =
74 static_cast<WebMessagePortChannelImpl*>(port); 73 static_cast<WebMessagePortChannelImpl*>(port);
75 74
76 if (main_loop_->BelongsToCurrentThread()) { 75 if (main_loop_->BelongsToCurrentThread()) {
77 SendConnectMessage(thread_safe_sender_, CurrentWorkerId(), request_id, 76 SendConnectMessage(thread_safe_sender_, CurrentWorkerId(), request_id,
78 target_url, GURL(origin), 77 target_url, GURL(origin),
79 QueueMessagesAndGetMessagePortId(webchannel)); 78 QueueMessagesAndGetMessagePortId(webchannel));
80 } else { 79 } else {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 callbacks->onError(); 133 callbacks->onError();
135 } 134 }
136 requests_.Remove(request_id); 135 requests_.Remove(request_id);
137 } 136 }
138 137
139 void NavigatorConnectProvider::OnWorkerRunLoopStopped() { 138 void NavigatorConnectProvider::OnWorkerRunLoopStopped() {
140 delete this; 139 delete this;
141 } 140 }
142 141
143 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/child/navigator_connect/navigator_connect_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698