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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
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 WorkerProcessAllocated( |
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); |
105 | 104 |
| 105 void StartWorkerWithProcessId( |
| 106 scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params, |
| 107 const StatusCallback& callback, |
| 108 int process_id, |
| 109 int worker_devtools_agent_route_id, |
| 110 bool pause_on_start); |
| 111 |
106 ServiceWorkerStatusCode Send(int process_id, IPC::Message* message); | 112 ServiceWorkerStatusCode Send(int process_id, IPC::Message* message); |
107 | 113 |
108 // RemoveWorker is called when EmbeddedWorkerInstance is destructed. | 114 // RemoveWorker is called when EmbeddedWorkerInstance is destructed. |
109 // |process_id| could be invalid (i.e. -1) if it's not running. | 115 // |process_id| could be invalid (i.e. -1) if it's not running. |
110 void RemoveWorker(int process_id, int embedded_worker_id); | 116 void RemoveWorker(int process_id, int embedded_worker_id); |
111 | 117 |
112 base::WeakPtr<ServiceWorkerContextCore> context_; | 118 base::WeakPtr<ServiceWorkerContextCore> context_; |
113 | 119 |
114 WorkerInstanceMap worker_map_; | 120 WorkerInstanceMap worker_map_; |
115 ProcessToSenderMap process_sender_map_; | 121 ProcessToSenderMap process_sender_map_; |
116 | 122 |
117 // Map from process_id to embedded_worker_id. | 123 // Map from process_id to embedded_worker_id. |
118 // This map only contains running workers. | 124 // This map only contains running workers. |
119 std::map<int, std::set<int> > worker_process_map_; | 125 std::map<int, std::set<int> > worker_process_map_; |
120 | 126 |
121 int next_embedded_worker_id_; | 127 int next_embedded_worker_id_; |
122 | 128 |
123 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry); | 129 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerRegistry); |
124 }; | 130 }; |
125 | 131 |
126 } // namespace content | 132 } // namespace content |
127 | 133 |
128 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ | 134 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_REGISTRY_H_ |
OLD | NEW |