| 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_EMBEDDED_WORKER_REGISTRY_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 private: | 90 private: |
| 91 friend class base::RefCounted<EmbeddedWorkerRegistry>; | 91 friend class base::RefCounted<EmbeddedWorkerRegistry>; |
| 92 friend class EmbeddedWorkerInstance; | 92 friend class EmbeddedWorkerInstance; |
| 93 | 93 |
| 94 typedef std::map<int, EmbeddedWorkerInstance*> WorkerInstanceMap; | 94 typedef std::map<int, EmbeddedWorkerInstance*> WorkerInstanceMap; |
| 95 typedef std::map<int, IPC::Sender*> ProcessToSenderMap; | 95 typedef std::map<int, IPC::Sender*> ProcessToSenderMap; |
| 96 | 96 |
| 97 ~EmbeddedWorkerRegistry(); | 97 ~EmbeddedWorkerRegistry(); |
| 98 | 98 |
| 99 void StartWorkerWithProcessId( | 99 void StartWorkerWithProcessId( |
| 100 int embedded_worker_id, | |
| 101 scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params, | 100 scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params, |
| 102 const StatusCallback& callback, | 101 const StatusCallback& callback, |
| 103 ServiceWorkerStatusCode status, | 102 ServiceWorkerStatusCode status, |
| 104 int process_id); | 103 int process_id, |
| 104 int worker_devtools_agent_route_id, |
| 105 bool pause_on_start); |
| 105 | 106 |
| 106 ServiceWorkerStatusCode Send(int process_id, IPC::Message* message); | 107 ServiceWorkerStatusCode Send(int process_id, IPC::Message* message); |
| 107 | 108 |
| 108 // RemoveWorker is called when EmbeddedWorkerInstance is destructed. | 109 // RemoveWorker is called when EmbeddedWorkerInstance is destructed. |
| 109 // |process_id| could be invalid (i.e. -1) if it's not running. | 110 // |process_id| could be invalid (i.e. -1) if it's not running. |
| 110 void RemoveWorker(int process_id, int embedded_worker_id); | 111 void RemoveWorker(int process_id, int embedded_worker_id); |
| 111 | 112 |
| 112 base::WeakPtr<ServiceWorkerContextCore> context_; | 113 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 113 | 114 |
| 114 WorkerInstanceMap worker_map_; | 115 WorkerInstanceMap worker_map_; |
| 115 ProcessToSenderMap process_sender_map_; | 116 ProcessToSenderMap process_sender_map_; |
| 116 | 117 |
| 117 // Map from process_id to embedded_worker_id. | 118 // Map from process_id to embedded_worker_id. |
| 118 // This map only contains running workers. | 119 // This map only contains running workers. |
| 119 std::map<int, std::set<int> > worker_process_map_; | 120 std::map<int, std::set<int> > worker_process_map_; |
| 120 | 121 |
| 121 int next_embedded_worker_id_; | 122 int next_embedded_worker_id_; |
| 122 | 123 |
| 123 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry); | 124 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry); |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 } // namespace content | 127 } // namespace content |
| 127 | 128 |
| 128 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ | 129 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ |
| OLD | NEW |