| 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 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/child/webmessageportchannel_impl.h" | 17 #include "content/child/webmessageportchannel_impl.h" |
| 18 #include "content/common/mojo/service_registry_impl.h" |
| 18 #include "content/common/service_worker/service_worker_types.h" | 19 #include "content/common/service_worker/service_worker_types.h" |
| 19 #include "ipc/ipc_listener.h" | 20 #include "ipc/ipc_listener.h" |
| 20 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" | 21 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" |
| 21 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 22 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
| 22 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" | 23 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" |
| 23 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 24 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 27 class TaskRunner; | 28 class TaskRunner; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 int64 service_worker_version_id, | 65 int64 service_worker_version_id, |
| 65 const GURL& service_worker_scope, | 66 const GURL& service_worker_scope, |
| 66 const GURL& script_url, | 67 const GURL& script_url, |
| 67 int worker_devtools_agent_route_id); | 68 int worker_devtools_agent_route_id); |
| 68 ~ServiceWorkerContextClient() override; | 69 ~ServiceWorkerContextClient() override; |
| 69 | 70 |
| 70 void OnMessageReceived(int thread_id, | 71 void OnMessageReceived(int thread_id, |
| 71 int embedded_worker_id, | 72 int embedded_worker_id, |
| 72 const IPC::Message& message); | 73 const IPC::Message& message); |
| 73 | 74 |
| 75 void BindServiceRegistry( |
| 76 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 77 mojo::ServiceProviderPtr exposed_services); |
| 78 |
| 74 // WebServiceWorkerContextClient overrides. | 79 // WebServiceWorkerContextClient overrides. |
| 75 virtual blink::WebURL scope() const; | 80 virtual blink::WebURL scope() const; |
| 76 virtual void didPauseAfterDownload(); | 81 virtual void didPauseAfterDownload(); |
| 77 virtual void getClients(const blink::WebServiceWorkerClientQueryOptions&, | 82 virtual void getClients(const blink::WebServiceWorkerClientQueryOptions&, |
| 78 blink::WebServiceWorkerClientsCallbacks*); | 83 blink::WebServiceWorkerClientsCallbacks*); |
| 79 virtual void openWindow(const blink::WebURL&, | 84 virtual void openWindow(const blink::WebURL&, |
| 80 blink::WebServiceWorkerClientCallbacks*); | 85 blink::WebServiceWorkerClientCallbacks*); |
| 81 virtual void setCachedMetadata(const blink::WebURL&, | 86 virtual void setCachedMetadata(const blink::WebURL&, |
| 82 const char* data, | 87 const char* data, |
| 83 size_t size); | 88 size_t size); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 218 |
| 214 // Used for incoming messages from the browser for which an outgoing response | 219 // Used for incoming messages from the browser for which an outgoing response |
| 215 // back to the browser is expected, the id must be sent back with the | 220 // back to the browser is expected, the id must be sent back with the |
| 216 // response. | 221 // response. |
| 217 int current_request_id_; | 222 int current_request_id_; |
| 218 | 223 |
| 219 // Initialized on the worker thread in workerContextStarted and | 224 // Initialized on the worker thread in workerContextStarted and |
| 220 // destructed on the worker thread in willDestroyWorkerContext. | 225 // destructed on the worker thread in willDestroyWorkerContext. |
| 221 scoped_ptr<WorkerContextData> context_; | 226 scoped_ptr<WorkerContextData> context_; |
| 222 | 227 |
| 228 ServiceRegistryImpl service_registry_; |
| 229 |
| 223 // Capture timestamps for UMA | 230 // Capture timestamps for UMA |
| 224 std::map<int, base::TimeTicks> activate_start_timings_; | 231 std::map<int, base::TimeTicks> activate_start_timings_; |
| 225 std::map<int, base::TimeTicks> fetch_start_timings_; | 232 std::map<int, base::TimeTicks> fetch_start_timings_; |
| 226 std::map<int, base::TimeTicks> install_start_timings_; | 233 std::map<int, base::TimeTicks> install_start_timings_; |
| 227 std::map<int, base::TimeTicks> notification_click_start_timings_; | 234 std::map<int, base::TimeTicks> notification_click_start_timings_; |
| 228 std::map<int, base::TimeTicks> push_start_timings_; | 235 std::map<int, base::TimeTicks> push_start_timings_; |
| 229 | 236 |
| 230 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 237 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
| 231 }; | 238 }; |
| 232 | 239 |
| 233 } // namespace content | 240 } // namespace content |
| 234 | 241 |
| 235 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 242 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |