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

Side by Side Diff: chrome/browser/profiles/profile_destroyer.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile_destroyer.h" 5 #include "chrome/browser/profiles/profile_destroyer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const content::NotificationSource& source, 134 const content::NotificationSource& source,
135 const content::NotificationDetails& details) { 135 const content::NotificationDetails& details) {
136 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); 136 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED);
137 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 137 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
138 source); 138 source);
139 DCHECK(num_hosts_ > 0); 139 DCHECK(num_hosts_ > 0);
140 --num_hosts_; 140 --num_hosts_;
141 if (num_hosts_ == 0) { 141 if (num_hosts_ == 0) {
142 // Delay the destruction one step further in case other observers of this 142 // Delay the destruction one step further in case other observers of this
143 // notification need to look at the profile attached to the host. 143 // notification need to look at the profile attached to the host.
144 MessageLoop::current()->PostTask( 144 base::MessageLoop::current()->PostTask(
145 FROM_HERE, base::Bind(&ProfileDestroyer::DestroyProfile, this)); 145 FROM_HERE, base::Bind(&ProfileDestroyer::DestroyProfile, this));
146 } 146 }
147 } 147 }
148 148
149 void ProfileDestroyer::DestroyProfile() { 149 void ProfileDestroyer::DestroyProfile() {
150 // We might have been cancelled externally before the timer expired. 150 // We might have been cancelled externally before the timer expired.
151 if (profile_ == NULL) 151 if (profile_ == NULL)
152 return; 152 return;
153 DCHECK(profile_->IsOffTheRecord()); 153 DCHECK(profile_->IsOffTheRecord());
154 DCHECK(profile_->GetOriginalProfile()); 154 DCHECK(profile_->GetOriginalProfile());
(...skipping 16 matching lines...) Expand all
171 content::RenderProcessHost::AllHostsIterator()); 171 content::RenderProcessHost::AllHostsIterator());
172 !iter.IsAtEnd(); iter.Advance()) { 172 !iter.IsAtEnd(); iter.Advance()) {
173 content::RenderProcessHost* render_process_host = iter.GetCurrentValue(); 173 content::RenderProcessHost* render_process_host = iter.GetCurrentValue();
174 if (render_process_host && Profile::FromBrowserContext( 174 if (render_process_host && Profile::FromBrowserContext(
175 render_process_host->GetBrowserContext()) == profile) { 175 render_process_host->GetBrowserContext()) == profile) {
176 hosts->push_back(render_process_host); 176 hosts->push_back(render_process_host);
177 } 177 }
178 } 178 }
179 return !hosts->empty(); 179 return !hosts->empty();
180 } 180 }
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_linux.cc ('k') | chrome/browser/profiles/profile_destroyer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698