| OLD | NEW |
| 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/public/common/navigator_connect_client.h" |
| 14 #include "third_party/WebKit/public/platform/WebURL.h" | 14 #include "third_party/WebKit/public/platform/WebURL.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 base::LazyInstance<base::ThreadLocalPointer<NavigatorConnectProvider>>::Leaky | 20 base::LazyInstance<base::ThreadLocalPointer<NavigatorConnectProvider>>::Leaky |
| 21 g_provider_tls = LAZY_INSTANCE_INITIALIZER; | 21 g_provider_tls = LAZY_INSTANCE_INITIALIZER; |
| 22 | 22 |
| 23 NavigatorConnectProvider* const kHasBeenDeleted = | 23 NavigatorConnectProvider* const kHasBeenDeleted = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 void SendConnectMessage(const scoped_refptr<ThreadSafeSender>& sender, | 41 void SendConnectMessage(const scoped_refptr<ThreadSafeSender>& sender, |
| 42 int thread_id, | 42 int thread_id, |
| 43 int request_id, | 43 int request_id, |
| 44 const GURL& target_url, | 44 const GURL& target_url, |
| 45 const GURL& origin, | 45 const GURL& origin, |
| 46 int message_port_id) { | 46 int message_port_id) { |
| 47 sender->Send(new NavigatorConnectHostMsg_Connect( | 47 sender->Send(new NavigatorConnectHostMsg_Connect( |
| 48 thread_id, request_id, | 48 thread_id, request_id, |
| 49 CrossOriginServiceWorkerClient(target_url, origin, message_port_id))); | 49 NavigatorConnectClient(target_url, origin, message_port_id))); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 NavigatorConnectProvider::NavigatorConnectProvider( | 54 NavigatorConnectProvider::NavigatorConnectProvider( |
| 55 ThreadSafeSender* thread_safe_sender, | 55 ThreadSafeSender* thread_safe_sender, |
| 56 const scoped_refptr<base::SingleThreadTaskRunner>& main_loop) | 56 const scoped_refptr<base::SingleThreadTaskRunner>& main_loop) |
| 57 : thread_safe_sender_(thread_safe_sender), main_loop_(main_loop) { | 57 : thread_safe_sender_(thread_safe_sender), main_loop_(main_loop) { |
| 58 g_provider_tls.Pointer()->Set(this); | 58 g_provider_tls.Pointer()->Set(this); |
| 59 } | 59 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 callbacks->onError(); | 133 callbacks->onError(); |
| 134 } | 134 } |
| 135 requests_.Remove(request_id); | 135 requests_.Remove(request_id); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void NavigatorConnectProvider::OnWorkerRunLoopStopped() { | 138 void NavigatorConnectProvider::OnWorkerRunLoopStopped() { |
| 139 delete this; | 139 delete this; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace content | 142 } // namespace content |
| OLD | NEW |