| 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "content/browser/service_worker/service_worker_registration_status.h" | 13 #include "content/browser/service_worker/service_worker_registration_status.h" |
| 14 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params; | 17 struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params; |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class MessagePortMessageFilter; | 21 class MessagePortMessageFilter; |
| 22 class ServiceWorkerContextCore; | 22 class ServiceWorkerContextCore; |
| 23 class ServiceWorkerContextWrapper; | 23 class ServiceWorkerContextWrapper; |
| 24 class ServiceWorkerHandle; | 24 class ServiceWorkerHandle; |
| 25 class ServiceWorkerProviderHost; | 25 class ServiceWorkerProviderHost; |
| 26 class ServiceWorkerRegistration; | 26 class ServiceWorkerRegistration; |
| 27 class ServiceWorkerRegistrationHandle; | 27 class ServiceWorkerRegistrationHandle; |
| 28 struct ServiceWorkerRegistrationObjectInfo; |
| 28 | 29 |
| 29 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { | 30 class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { |
| 30 public: | 31 public: |
| 31 ServiceWorkerDispatcherHost( | 32 ServiceWorkerDispatcherHost( |
| 32 int render_process_id, | 33 int render_process_id, |
| 33 MessagePortMessageFilter* message_port_message_filter); | 34 MessagePortMessageFilter* message_port_message_filter); |
| 34 | 35 |
| 35 void Init(ServiceWorkerContextWrapper* context_wrapper); | 36 void Init(ServiceWorkerContextWrapper* context_wrapper); |
| 36 | 37 |
| 37 // BrowserMessageFilter implementation | 38 // BrowserMessageFilter implementation |
| 38 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; | 39 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; |
| 39 virtual void OnDestruct() const OVERRIDE; | 40 virtual void OnDestruct() const OVERRIDE; |
| 40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 41 | 42 |
| 42 // IPC::Sender implementation | 43 // IPC::Sender implementation |
| 43 | 44 |
| 44 // Send() queues the message until the underlying sender is ready. This | 45 // Send() queues the message until the underlying sender is ready. This |
| 45 // class assumes that Send() can only fail after that when the renderer | 46 // class assumes that Send() can only fail after that when the renderer |
| 46 // process has terminated, at which point the whole instance will eventually | 47 // process has terminated, at which point the whole instance will eventually |
| 47 // be destroyed. | 48 // be destroyed. |
| 48 virtual bool Send(IPC::Message* message) OVERRIDE; | 49 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 49 | 50 |
| 50 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); | 51 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); |
| 51 void RegisterServiceWorkerRegistrationHandle( | 52 void RegisterServiceWorkerRegistrationHandle( |
| 52 scoped_ptr<ServiceWorkerRegistrationHandle> handle); | 53 scoped_ptr<ServiceWorkerRegistrationHandle> handle); |
| 53 | 54 |
| 55 ServiceWorkerRegistrationObjectInfo GetOrCreateRegistrationHandle( |
| 56 int provider_id, |
| 57 ServiceWorkerRegistration* registration); |
| 58 |
| 54 MessagePortMessageFilter* message_port_message_filter() { | 59 MessagePortMessageFilter* message_port_message_filter() { |
| 55 return message_port_message_filter_; | 60 return message_port_message_filter_; |
| 56 } | 61 } |
| 57 | 62 |
| 58 protected: | 63 protected: |
| 59 virtual ~ServiceWorkerDispatcherHost(); | 64 virtual ~ServiceWorkerDispatcherHost(); |
| 60 | 65 |
| 61 private: | 66 private: |
| 62 friend class BrowserThread; | 67 friend class BrowserThread; |
| 63 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | 68 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 138 |
| 134 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. | 139 bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. |
| 135 ScopedVector<IPC::Message> pending_messages_; | 140 ScopedVector<IPC::Message> pending_messages_; |
| 136 | 141 |
| 137 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 142 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
| 138 }; | 143 }; |
| 139 | 144 |
| 140 } // namespace content | 145 } // namespace content |
| 141 | 146 |
| 142 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 147 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| OLD | NEW |