| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 ProfileDestroyer::~ProfileDestroyer() { | 120 ProfileDestroyer::~ProfileDestroyer() { |
| 121 // Check again, in case other render hosts were added while we were | 121 // Check again, in case other render hosts were added while we were |
| 122 // waiting for the previous ones to go away... | 122 // waiting for the previous ones to go away... |
| 123 if (profile_) | 123 if (profile_) |
| 124 DestroyProfileWhenAppropriate(profile_); | 124 DestroyProfileWhenAppropriate(profile_); |
| 125 | 125 |
| 126 #ifdef NDEBUG | 126 #ifdef NDEBUG |
| 127 // Don't wait for pending registrations, if any, these hosts are buggy. | 127 // Don't wait for pending registrations, if any, these hosts are buggy. |
| 128 // Note: this can happen, but if so, it's better to crash here than wait | 128 // Note: this can happen, but if so, it's better to crash here than wait |
| 129 // for the host to dereference a deleted Profile. http://crbug.com/248625 | 129 // for the host to dereference a deleted Profile. http://crbug.com/248625 |
| 130 CHECK_EQ(0U, num_hosts_) << "Some render process hosts were not " | 130 // Some render process hosts were not destroyed early enough! |
| 131 << "destroyed early enough!"; | 131 CHECK_EQ(0U, num_hosts_); |
| 132 #endif // NDEBUG | 132 #endif // NDEBUG |
| 133 DCHECK(pending_destroyers_ != NULL); | 133 DCHECK(pending_destroyers_ != NULL); |
| 134 DestroyerSet::iterator iter = pending_destroyers_->find(this); | 134 DestroyerSet::iterator iter = pending_destroyers_->find(this); |
| 135 DCHECK(iter != pending_destroyers_->end()); | 135 DCHECK(iter != pending_destroyers_->end()); |
| 136 pending_destroyers_->erase(iter); | 136 pending_destroyers_->erase(iter); |
| 137 if (pending_destroyers_->empty()) { | 137 if (pending_destroyers_->empty()) { |
| 138 delete pending_destroyers_; | 138 delete pending_destroyers_; |
| 139 pending_destroyers_ = NULL; | 139 pending_destroyers_ = NULL; |
| 140 } | 140 } |
| 141 } | 141 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 content::RenderProcessHost::AllHostsIterator()); | 178 content::RenderProcessHost::AllHostsIterator()); |
| 179 !iter.IsAtEnd(); iter.Advance()) { | 179 !iter.IsAtEnd(); iter.Advance()) { |
| 180 content::RenderProcessHost* render_process_host = iter.GetCurrentValue(); | 180 content::RenderProcessHost* render_process_host = iter.GetCurrentValue(); |
| 181 if (render_process_host && | 181 if (render_process_host && |
| 182 render_process_host->GetBrowserContext() == profile) { | 182 render_process_host->GetBrowserContext() == profile) { |
| 183 hosts->insert(render_process_host); | 183 hosts->insert(render_process_host); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 return !hosts->empty(); | 186 return !hosts->empty(); |
| 187 } | 187 } |
| OLD | NEW |