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 #include "content/browser/service_worker/service_worker_process_manager.h" | 5 #include "content/browser/service_worker/service_worker_process_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 if (IsShutdown()) { | 184 if (IsShutdown()) { |
185 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 185 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
186 base::Bind(callback, SERVICE_WORKER_ERROR_ABORT, | 186 base::Bind(callback, SERVICE_WORKER_ERROR_ABORT, |
187 ChildProcessHost::kInvalidUniqueID, | 187 ChildProcessHost::kInvalidUniqueID, |
188 false /* is_new_process */, settings)); | 188 false /* is_new_process */, settings)); |
189 return; | 189 return; |
190 } | 190 } |
191 | 191 |
192 DCHECK(!ContainsKey(instance_info_, embedded_worker_id)) | 192 DCHECK(!base::ContainsKey(instance_info_, embedded_worker_id)) |
193 << embedded_worker_id << " already has a process allocated"; | 193 << embedded_worker_id << " already has a process allocated"; |
194 | 194 |
195 if (can_use_existing_process) { | 195 if (can_use_existing_process) { |
196 int process_id = FindAvailableProcess(pattern); | 196 int process_id = FindAvailableProcess(pattern); |
197 if (process_id != ChildProcessHost::kInvalidUniqueID) { | 197 if (process_id != ChildProcessHost::kInvalidUniqueID) { |
198 RenderProcessHost::FromID(process_id)->IncrementWorkerRefCount(); | 198 RenderProcessHost::FromID(process_id)->IncrementWorkerRefCount(); |
199 instance_info_.insert( | 199 instance_info_.insert( |
200 std::make_pair(embedded_worker_id, ProcessInfo(process_id))); | 200 std::make_pair(embedded_worker_id, ProcessInfo(process_id))); |
201 BrowserThread::PostTask( | 201 BrowserThread::PostTask( |
202 BrowserThread::IO, FROM_HERE, | 202 BrowserThread::IO, FROM_HERE, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 namespace std { | 330 namespace std { |
331 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the | 331 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the |
332 // member WeakPtr to safely guard the object's lifetime when used on that | 332 // member WeakPtr to safely guard the object's lifetime when used on that |
333 // thread. | 333 // thread. |
334 void default_delete<content::ServiceWorkerProcessManager>::operator()( | 334 void default_delete<content::ServiceWorkerProcessManager>::operator()( |
335 content::ServiceWorkerProcessManager* ptr) const { | 335 content::ServiceWorkerProcessManager* ptr) const { |
336 content::BrowserThread::DeleteSoon( | 336 content::BrowserThread::DeleteSoon( |
337 content::BrowserThread::UI, FROM_HERE, ptr); | 337 content::BrowserThread::UI, FROM_HERE, ptr); |
338 } | 338 } |
339 } // namespace std | 339 } // namespace std |
OLD | NEW |