| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 int thread_id() const { return thread_id_; } | 99 int thread_id() const { return thread_id_; } |
| 100 | 100 |
| 101 void AddListener(Listener* listener); | 101 void AddListener(Listener* listener); |
| 102 void RemoveListener(Listener* listener); | 102 void RemoveListener(Listener* listener); |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 typedef ObserverList<Listener> ListenerList; | 105 typedef ObserverList<Listener> ListenerList; |
| 106 | 106 |
| 107 friend class EmbeddedWorkerRegistry; | 107 friend class EmbeddedWorkerRegistry; |
| 108 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); | 108 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); |
| 109 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, SortProcesses); |
| 109 | 110 |
| 110 typedef std::map<int, int> ProcessRefMap; | 111 typedef std::map<int, int> ProcessRefMap; |
| 111 | 112 |
| 112 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker(). | 113 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker(). |
| 113 // This instance holds a ref of |registry|. | 114 // This instance holds a ref of |registry|. |
| 114 EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context, | 115 EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context, |
| 115 int embedded_worker_id); | 116 int embedded_worker_id); |
| 116 | 117 |
| 117 // Called back from ServiceWorkerProcessManager after Start() passes control | 118 // Called back from ServiceWorkerProcessManager after Start() passes control |
| 118 // to the UI thread to acquire a reference to the process. | 119 // to the UI thread to acquire a reference to the process. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 ListenerList listener_list_; | 192 ListenerList listener_list_; |
| 192 | 193 |
| 193 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 194 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
| 194 | 195 |
| 195 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 196 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
| 196 }; | 197 }; |
| 197 | 198 |
| 198 } // namespace content | 199 } // namespace content |
| 199 | 200 |
| 200 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 201 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| OLD | NEW |