| OLD | NEW |
| 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 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ |
| 6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class MessageLoopProxy; | 22 class MessageLoopProxy; |
| 23 class TaskRunner; | 23 class TaskRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 class WebDataSource; | 27 class WebDataSource; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| 32 class ServiceWorkerProviderContext; |
| 32 class ServiceWorkerScriptContext; | 33 class ServiceWorkerScriptContext; |
| 33 class ThreadSafeSender; | 34 class ThreadSafeSender; |
| 34 | 35 |
| 35 // This class provides access to/from an embedded worker's WorkerGlobalScope. | 36 // This class provides access to/from an embedded worker's WorkerGlobalScope. |
| 36 // All methods other than the constructor (it's created on the main thread) | 37 // All methods other than the constructor (it's created on the main thread) |
| 37 // and createServiceWorkerNetworkProvider (also called on the main thread) | 38 // and createServiceWorkerNetworkProvider (also called on the main thread) |
| 38 // are called on the worker thread. | 39 // are called on the worker thread. |
| 39 // | 40 // |
| 40 // TODO(kinuko): Currently EW/SW separation is made a little hazily. | 41 // TODO(kinuko): Currently EW/SW separation is made a little hazily. |
| 41 // This should implement WebEmbeddedWorkerContextClient | 42 // This should implement WebEmbeddedWorkerContextClient |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 base::MessageLoopProxy* main_thread_proxy() const { | 123 base::MessageLoopProxy* main_thread_proxy() const { |
| 123 return main_thread_proxy_.get(); | 124 return main_thread_proxy_.get(); |
| 124 } | 125 } |
| 125 ThreadSafeSender* thread_safe_sender() { return sender_.get(); } | 126 ThreadSafeSender* thread_safe_sender() { return sender_.get(); } |
| 126 | 127 |
| 127 private: | 128 private: |
| 128 void OnMessageToWorker(int thread_id, | 129 void OnMessageToWorker(int thread_id, |
| 129 int embedded_worker_id, | 130 int embedded_worker_id, |
| 130 const IPC::Message& message); | 131 const IPC::Message& message); |
| 131 void SendWorkerStarted(); | 132 void SendWorkerStarted(); |
| 133 void SetRegistrationInServiceWorkerGlobalScope(); |
| 132 | 134 |
| 133 const int embedded_worker_id_; | 135 const int embedded_worker_id_; |
| 134 const int64 service_worker_version_id_; | 136 const int64 service_worker_version_id_; |
| 135 const GURL service_worker_scope_; | 137 const GURL service_worker_scope_; |
| 136 const GURL script_url_; | 138 const GURL script_url_; |
| 137 const int worker_devtools_agent_route_id_; | 139 const int worker_devtools_agent_route_id_; |
| 138 scoped_refptr<ThreadSafeSender> sender_; | 140 scoped_refptr<ThreadSafeSender> sender_; |
| 139 scoped_refptr<base::MessageLoopProxy> main_thread_proxy_; | 141 scoped_refptr<base::MessageLoopProxy> main_thread_proxy_; |
| 140 scoped_refptr<base::TaskRunner> worker_task_runner_; | 142 scoped_refptr<base::TaskRunner> worker_task_runner_; |
| 141 | 143 |
| 142 scoped_ptr<ServiceWorkerScriptContext> script_context_; | 144 scoped_ptr<ServiceWorkerScriptContext> script_context_; |
| 145 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
| 143 | 146 |
| 144 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_; | 147 base::WeakPtrFactory<EmbeddedWorkerContextClient> weak_factory_; |
| 145 | 148 |
| 146 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient); | 149 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerContextClient); |
| 147 }; | 150 }; |
| 148 | 151 |
| 149 } // namespace content | 152 } // namespace content |
| 150 | 153 |
| 151 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ | 154 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |