Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: content/browser/service_worker/service_worker_process_manager.cc

Issue 1569773002: ServiceWorker: Make start worker sequence cancelable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test failures Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 if (IsShutdown()) { 229 if (IsShutdown()) {
230 // Shutdown already released all instances. 230 // Shutdown already released all instances.
231 DCHECK(instance_info_.empty()); 231 DCHECK(instance_info_.empty());
232 return; 232 return;
233 } 233 }
234 234
235 std::map<int, ProcessInfo>::iterator info = 235 std::map<int, ProcessInfo>::iterator info =
236 instance_info_.find(embedded_worker_id); 236 instance_info_.find(embedded_worker_id);
237 // TODO(nhiroki): Make sure the instance info is not mixed up. 237 // ReleaseWorkerProcess could be called for a nonexistent worker id, for
238 // (http://crbug.com/568915) 238 // example, when request to start a worker is aborted on the IO thread during
239 CHECK(info != instance_info_.end()); 239 // process allocation that is failed on the UI thread.
240 if (info == instance_info_.end())
241 return;
240 242
241 RenderProcessHost* rph = NULL; 243 RenderProcessHost* rph = NULL;
242 if (info->second.site_instance.get()) { 244 if (info->second.site_instance.get()) {
243 rph = info->second.site_instance->GetProcess(); 245 rph = info->second.site_instance->GetProcess();
244 DCHECK_EQ(info->second.process_id, rph->GetID()) 246 DCHECK_EQ(info->second.process_id, rph->GetID())
245 << "A SiteInstance's process shouldn't get destroyed while we're " 247 << "A SiteInstance's process shouldn't get destroyed while we're "
246 "holding a reference to it. Was the reference actually held?"; 248 "holding a reference to it. Was the reference actually held?";
247 } else { 249 } else {
248 rph = RenderProcessHost::FromID(info->second.process_id); 250 rph = RenderProcessHost::FromID(info->second.process_id);
249 DCHECK(rph) 251 DCHECK(rph)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 namespace std { 306 namespace std {
305 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the 307 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the
306 // member WeakPtr to safely guard the object's lifetime when used on that 308 // member WeakPtr to safely guard the object's lifetime when used on that
307 // thread. 309 // thread.
308 void default_delete<content::ServiceWorkerProcessManager>::operator()( 310 void default_delete<content::ServiceWorkerProcessManager>::operator()(
309 content::ServiceWorkerProcessManager* ptr) const { 311 content::ServiceWorkerProcessManager* ptr) const {
310 content::BrowserThread::DeleteSoon( 312 content::BrowserThread::DeleteSoon(
311 content::BrowserThread::UI, FROM_HERE, ptr); 313 content::BrowserThread::UI, FROM_HERE, ptr);
312 } 314 }
313 } // namespace std 315 } // namespace std
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698