| 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 "base/id_map.h" | 8 #include "base/id_map.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 29 matching lines...) Expand all Loading... |
| 40 // IPC::Sender implementation | 40 // IPC::Sender implementation |
| 41 | 41 |
| 42 // Send() queues the message until the underlying channel is ready. This | 42 // Send() queues the message until the underlying channel is ready. This |
| 43 // class assumes that Send() can only fail after that when the renderer | 43 // class assumes that Send() can only fail after that when the renderer |
| 44 // process has terminated, at which point the whole instance will eventually | 44 // process has terminated, at which point the whole instance will eventually |
| 45 // be destroyed. | 45 // be destroyed. |
| 46 virtual bool Send(IPC::Message* message) OVERRIDE; | 46 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 47 | 47 |
| 48 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); | 48 void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); |
| 49 | 49 |
| 50 // Updates message ports registered for |message_port_ids| and return |
| 51 // new routing IDs for the updated ports. |
| 52 // Non-null |new_routing_ids| must be given. |
| 53 void UpdateMessagePorts(const std::vector<int>& message_port_ids, |
| 54 std::vector<int>* new_routing_ids); |
| 55 |
| 50 protected: | 56 protected: |
| 51 virtual ~ServiceWorkerDispatcherHost(); | 57 virtual ~ServiceWorkerDispatcherHost(); |
| 52 | 58 |
| 53 private: | 59 private: |
| 54 friend class BrowserThread; | 60 friend class BrowserThread; |
| 55 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; | 61 friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; |
| 56 friend class TestingServiceWorkerDispatcherHost; | 62 friend class TestingServiceWorkerDispatcherHost; |
| 57 | 63 |
| 58 // IPC Message handlers | 64 // IPC Message handlers |
| 59 void OnRegisterServiceWorker(int thread_id, | 65 void OnRegisterServiceWorker(int thread_id, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 77 int column_number, | 83 int column_number, |
| 78 const GURL& source_url); | 84 const GURL& source_url); |
| 79 void OnReportConsoleMessage( | 85 void OnReportConsoleMessage( |
| 80 int embedded_worker_id, | 86 int embedded_worker_id, |
| 81 const EmbeddedWorkerHostMsg_ReportConsoleMessage_Params& params); | 87 const EmbeddedWorkerHostMsg_ReportConsoleMessage_Params& params); |
| 82 void OnPostMessage(int handle_id, | 88 void OnPostMessage(int handle_id, |
| 83 const base::string16& message, | 89 const base::string16& message, |
| 84 const std::vector<int>& sent_message_port_ids); | 90 const std::vector<int>& sent_message_port_ids); |
| 85 void OnIncrementServiceWorkerRefCount(int handle_id); | 91 void OnIncrementServiceWorkerRefCount(int handle_id); |
| 86 void OnDecrementServiceWorkerRefCount(int handle_id); | 92 void OnDecrementServiceWorkerRefCount(int handle_id); |
| 93 void OnPostMessageToWorker(int handle_id, |
| 94 const base::string16& message, |
| 95 const std::vector<int>& sent_message_port_ids); |
| 96 void OnServiceWorkerObjectDestroyed(int handle_id); |
| 87 | 97 |
| 88 // Callbacks from ServiceWorkerContextCore | 98 // Callbacks from ServiceWorkerContextCore |
| 89 void RegistrationComplete(int thread_id, | 99 void RegistrationComplete(int thread_id, |
| 90 int request_id, | 100 int request_id, |
| 91 ServiceWorkerStatusCode status, | 101 ServiceWorkerStatusCode status, |
| 92 int64 registration_id, | 102 int64 registration_id, |
| 93 int64 version_id); | 103 int64 version_id); |
| 94 | 104 |
| 95 void UnregistrationComplete(int thread_id, | 105 void UnregistrationComplete(int thread_id, |
| 96 int request_id, | 106 int request_id, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 108 | 118 |
| 109 bool channel_ready_; // True after BrowserMessageFilter::channel_ != NULL. | 119 bool channel_ready_; // True after BrowserMessageFilter::channel_ != NULL. |
| 110 ScopedVector<IPC::Message> pending_messages_; | 120 ScopedVector<IPC::Message> pending_messages_; |
| 111 | 121 |
| 112 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); | 122 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); |
| 113 }; | 123 }; |
| 114 | 124 |
| 115 } // namespace content | 125 } // namespace content |
| 116 | 126 |
| 117 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ | 127 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ |
| OLD | NEW |