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

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

Issue 508433002: Remove implicit conversions from scoped_refptr to T* in content/browser/service_worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 "content/browser/renderer_host/render_process_host_impl.h" 7 #include "content/browser/renderer_host/render_process_host_impl.h"
8 #include "content/browser/service_worker/service_worker_context_wrapper.h" 8 #include "content/browser/service_worker/service_worker_context_wrapper.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/site_instance.h" 10 #include "content/public/browser/site_instance.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 if (browser_context_ == NULL) { 158 if (browser_context_ == NULL) {
159 // Shutdown already released all instances. 159 // Shutdown already released all instances.
160 DCHECK(instance_info_.empty()); 160 DCHECK(instance_info_.empty());
161 return; 161 return;
162 } 162 }
163 std::map<int, ProcessInfo>::iterator info = 163 std::map<int, ProcessInfo>::iterator info =
164 instance_info_.find(embedded_worker_id); 164 instance_info_.find(embedded_worker_id);
165 DCHECK(info != instance_info_.end()); 165 DCHECK(info != instance_info_.end());
166 RenderProcessHost* rph = NULL; 166 RenderProcessHost* rph = NULL;
167 if (info->second.site_instance) { 167 if (info->second.site_instance.get()) {
168 rph = info->second.site_instance->GetProcess(); 168 rph = info->second.site_instance->GetProcess();
169 DCHECK_EQ(info->second.process_id, rph->GetID()) 169 DCHECK_EQ(info->second.process_id, rph->GetID())
170 << "A SiteInstance's process shouldn't get destroyed while we're " 170 << "A SiteInstance's process shouldn't get destroyed while we're "
171 "holding a reference to it. Was the reference actually held?"; 171 "holding a reference to it. Was the reference actually held?";
172 } else { 172 } else {
173 rph = RenderProcessHost::FromID(info->second.process_id); 173 rph = RenderProcessHost::FromID(info->second.process_id);
174 DCHECK(rph) 174 DCHECK(rph)
175 << "Process " << info->second.process_id 175 << "Process " << info->second.process_id
176 << " was destroyed unexpectedly. Did we actually hold a reference?"; 176 << " was destroyed unexpectedly. Did we actually hold a reference?";
177 } 177 }
178 static_cast<RenderProcessHostImpl*>(rph)->DecrementWorkerRefCount(); 178 static_cast<RenderProcessHostImpl*>(rph)->DecrementWorkerRefCount();
179 instance_info_.erase(info); 179 instance_info_.erase(info);
180 } 180 }
181 181
182 } // namespace content 182 } // namespace content
183 183
184 namespace base { 184 namespace base {
185 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the 185 // Destroying ServiceWorkerProcessManagers only on the UI thread allows the
186 // member WeakPtr to safely guard the object's lifetime when used on that 186 // member WeakPtr to safely guard the object's lifetime when used on that
187 // thread. 187 // thread.
188 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()( 188 void DefaultDeleter<content::ServiceWorkerProcessManager>::operator()(
189 content::ServiceWorkerProcessManager* ptr) const { 189 content::ServiceWorkerProcessManager* ptr) const {
190 content::BrowserThread::DeleteSoon( 190 content::BrowserThread::DeleteSoon(
191 content::BrowserThread::UI, FROM_HERE, ptr); 191 content::BrowserThread::UI, FROM_HERE, ptr);
192 } 192 }
193 } // namespace base 193 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698