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

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

Issue 1591543002: Only CHECK for RenderProcessHosts that outlive an incognito profile in release (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 weak_ptr_factory_.GetWeakPtr())); 115 weak_ptr_factory_.GetWeakPtr()));
116 } 116 }
117 } 117 }
118 118
119 ProfileDestroyer::~ProfileDestroyer() { 119 ProfileDestroyer::~ProfileDestroyer() {
120 // Check again, in case other render hosts were added while we were 120 // Check again, in case other render hosts were added while we were
121 // waiting for the previous ones to go away... 121 // waiting for the previous ones to go away...
122 if (profile_) 122 if (profile_)
123 DestroyProfileWhenAppropriate(profile_); 123 DestroyProfileWhenAppropriate(profile_);
124 124
125 #ifdef NDEBUG
125 // Don't wait for pending registrations, if any, these hosts are buggy. 126 // Don't wait for pending registrations, if any, these hosts are buggy.
126 // Note: this can happen, but if so, it's better to crash here than wait 127 // Note: this can happen, but if so, it's better to crash here than wait
127 // for the host to dereference a deleted Profile. http://crbug.com/248625 128 // for the host to dereference a deleted Profile. http://crbug.com/248625
128 CHECK_EQ(0U, num_hosts_) << "Some render process hosts were not " 129 CHECK_EQ(0U, num_hosts_) << "Some render process hosts were not "
129 << "destroyed early enough!"; 130 << "destroyed early enough!";
130 131 #endif // NDEBUG
131 DCHECK(pending_destroyers_ != NULL); 132 DCHECK(pending_destroyers_ != NULL);
132 DestroyerSet::iterator iter = pending_destroyers_->find(this); 133 DestroyerSet::iterator iter = pending_destroyers_->find(this);
133 DCHECK(iter != pending_destroyers_->end()); 134 DCHECK(iter != pending_destroyers_->end());
134 pending_destroyers_->erase(iter); 135 pending_destroyers_->erase(iter);
135 if (pending_destroyers_->empty()) { 136 if (pending_destroyers_->empty()) {
136 delete pending_destroyers_; 137 delete pending_destroyers_;
137 pending_destroyers_ = NULL; 138 pending_destroyers_ = NULL;
138 } 139 }
139 } 140 }
140 141
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 content::RenderProcessHost::AllHostsIterator()); 177 content::RenderProcessHost::AllHostsIterator());
177 !iter.IsAtEnd(); iter.Advance()) { 178 !iter.IsAtEnd(); iter.Advance()) {
178 content::RenderProcessHost* render_process_host = iter.GetCurrentValue(); 179 content::RenderProcessHost* render_process_host = iter.GetCurrentValue();
179 if (render_process_host && 180 if (render_process_host &&
180 render_process_host->GetBrowserContext() == profile) { 181 render_process_host->GetBrowserContext() == profile) {
181 hosts->insert(render_process_host); 182 hosts->insert(render_process_host);
182 } 183 }
183 } 184 }
184 return !hosts->empty(); 185 return !hosts->empty();
185 } 186 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698