OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 friend class SharedWorkerServiceImplTest; | 103 friend class SharedWorkerServiceImplTest; |
104 | 104 |
105 typedef void (*UpdateWorkerDependencyFunc)(const std::vector<int>&, | 105 typedef void (*UpdateWorkerDependencyFunc)(const std::vector<int>&, |
106 const std::vector<int>&); | 106 const std::vector<int>&); |
107 typedef bool (*TryIncrementWorkerRefCountFunc)(bool); | 107 typedef bool (*TryIncrementWorkerRefCountFunc)(bool); |
108 // Pair of render_process_id and worker_route_id. | 108 // Pair of render_process_id and worker_route_id. |
109 typedef std::pair<int, int> ProcessRouteIdPair; | 109 typedef std::pair<int, int> ProcessRouteIdPair; |
110 typedef base::ScopedPtrHashMap<ProcessRouteIdPair, | 110 typedef base::ScopedPtrHashMap<ProcessRouteIdPair, |
111 scoped_ptr<SharedWorkerHost>> WorkerHostMap; | 111 scoped_ptr<SharedWorkerHost>> WorkerHostMap; |
112 typedef base::ScopedPtrHashMap<int, scoped_ptr<SharedWorkerPendingInstance>> | 112 typedef base::ScopedPtrHashMap<int, scoped_ptr<SharedWorkerPendingInstance>> |
113 PendingInstaneMap; | 113 PendingInstanceMap; |
114 | 114 |
115 SharedWorkerServiceImpl(); | 115 SharedWorkerServiceImpl(); |
116 ~SharedWorkerServiceImpl() override; | 116 ~SharedWorkerServiceImpl() override; |
117 | 117 |
118 void ResetForTesting(); | 118 void ResetForTesting(); |
119 | 119 |
120 // Reserves the render process to create Shared Worker. This reservation | 120 // Reserves the render process to create Shared Worker. This reservation |
121 // procedure will be executed on UI thread and | 121 // procedure will be executed on UI thread and |
122 // RenderProcessReservedCallback() or RenderProcessReserveFailedCallback() | 122 // RenderProcessReservedCallback() or RenderProcessReserveFailedCallback() |
123 // will be called on IO thread. | 123 // will be called on IO thread. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void ChangeTryIncrementWorkerRefCountFuncForTesting(bool (*new_func)(int)); | 156 void ChangeTryIncrementWorkerRefCountFuncForTesting(bool (*new_func)(int)); |
157 | 157 |
158 std::set<int> last_worker_depended_renderers_; | 158 std::set<int> last_worker_depended_renderers_; |
159 // Function ptr to update worker dependency, tests may override this. | 159 // Function ptr to update worker dependency, tests may override this. |
160 UpdateWorkerDependencyFunc update_worker_dependency_; | 160 UpdateWorkerDependencyFunc update_worker_dependency_; |
161 | 161 |
162 // Function ptr to increment worker ref count, tests may override this. | 162 // Function ptr to increment worker ref count, tests may override this. |
163 static bool (*s_try_increment_worker_ref_count_)(int); | 163 static bool (*s_try_increment_worker_ref_count_)(int); |
164 | 164 |
165 WorkerHostMap worker_hosts_; | 165 WorkerHostMap worker_hosts_; |
166 PendingInstaneMap pending_instances_; | 166 PendingInstanceMap pending_instances_; |
167 int next_pending_instance_id_; | 167 int next_pending_instance_id_; |
168 | 168 |
169 base::ObserverList<WorkerServiceObserver> observers_; | 169 base::ObserverList<WorkerServiceObserver> observers_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); | 171 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); |
172 }; | 172 }; |
173 | 173 |
174 } // namespace content | 174 } // namespace content |
175 | 175 |
176 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 176 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
OLD | NEW |