| 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_INSTANCE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Add or remove |process_id| to the internal process set where this | 81 // Add or remove |process_id| to the internal process set where this |
| 82 // worker can be started. | 82 // worker can be started. |
| 83 void AddProcessReference(int process_id); | 83 void AddProcessReference(int process_id); |
| 84 void ReleaseProcessReference(int process_id); | 84 void ReleaseProcessReference(int process_id); |
| 85 bool HasProcessToRun() const { return !process_refs_.empty(); } | 85 bool HasProcessToRun() const { return !process_refs_.empty(); } |
| 86 | 86 |
| 87 int embedded_worker_id() const { return embedded_worker_id_; } | 87 int embedded_worker_id() const { return embedded_worker_id_; } |
| 88 Status status() const { return status_; } | 88 Status status() const { return status_; } |
| 89 int process_id() const { return process_id_; } | 89 int process_id() const { return process_id_; } |
| 90 int thread_id() const { return thread_id_; } | 90 int thread_id() const { return thread_id_; } |
| 91 int worker_route_id() const { return worker_route_id_; } |
| 91 | 92 |
| 92 void AddListener(Listener* listener); | 93 void AddListener(Listener* listener); |
| 93 void RemoveListener(Listener* listener); | 94 void RemoveListener(Listener* listener); |
| 94 | 95 |
| 95 private: | 96 private: |
| 96 typedef ObserverList<Listener> ListenerList; | 97 typedef ObserverList<Listener> ListenerList; |
| 97 | 98 |
| 98 friend class EmbeddedWorkerRegistry; | 99 friend class EmbeddedWorkerRegistry; |
| 99 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); | 100 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); |
| 100 | 101 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Returns false when no process is available. | 140 // Returns false when no process is available. |
| 140 bool ChooseProcess(); | 141 bool ChooseProcess(); |
| 141 | 142 |
| 142 scoped_refptr<EmbeddedWorkerRegistry> registry_; | 143 scoped_refptr<EmbeddedWorkerRegistry> registry_; |
| 143 const int embedded_worker_id_; | 144 const int embedded_worker_id_; |
| 144 Status status_; | 145 Status status_; |
| 145 | 146 |
| 146 // Current running information. -1 indicates the worker is not running. | 147 // Current running information. -1 indicates the worker is not running. |
| 147 int process_id_; | 148 int process_id_; |
| 148 int thread_id_; | 149 int thread_id_; |
| 150 int worker_route_id_; |
| 149 | 151 |
| 150 ProcessRefMap process_refs_; | 152 ProcessRefMap process_refs_; |
| 151 ListenerList listener_list_; | 153 ListenerList listener_list_; |
| 152 | 154 |
| 153 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 155 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 } // namespace content | 158 } // namespace content |
| 157 | 159 |
| 158 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 160 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| OLD | NEW |