summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/lifetime/application_lifetime.cc14
-rw-r--r--chrome/browser/ui/browser_iterator.h2
2 files changed, 9 insertions, 7 deletions
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index e5e637e..036f651 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
@@ -129,12 +130,13 @@ void CloseAllBrowsers() {
chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker(
"StartedClosingWindows", false);
#endif
- for (BrowserList::const_iterator i = BrowserList::begin();
- i != BrowserList::end();) {
- Browser* browser = *i;
+ for (scoped_ptr<chrome::BrowserIterator> it_ptr(
+ new chrome::BrowserIterator());
+ !it_ptr->done();) {
+ Browser* browser = **it_ptr;
browser->window()->Close();
if (!session_ending) {
- ++i;
+ it_ptr->Next();
} else {
// This path is hit during logoff/power-down. In this case we won't get
// a final message and so we force the browser to be deleted.
@@ -146,8 +148,8 @@ void CloseAllBrowsers() {
while (browser->tab_strip_model()->count())
delete browser->tab_strip_model()->GetWebContentsAt(0);
browser->window()->DestroyBrowser();
- i = BrowserList::begin();
- if (i != BrowserList::end() && browser == *i) {
+ it_ptr.reset(new chrome::BrowserIterator());
+ if (!it_ptr->done() && browser == **it_ptr) {
// Destroying the browser should have removed it from the browser list.
// We should never get here.
NOTREACHED();
diff --git a/chrome/browser/ui/browser_iterator.h b/chrome/browser/ui/browser_iterator.h
index 4911679..91ea8e8 100644
--- a/chrome/browser/ui/browser_iterator.h
+++ b/chrome/browser/ui/browser_iterator.h
@@ -27,7 +27,7 @@ class BrowserIterator {
public:
BrowserIterator();
- // Returns true if we are past the last Browser.
+ // Returns true if this iterator is past the last Browser.
bool done() const {
// |current_iterator_| is never at the end of a list unless it is done (it
// immediately moves to the next browser list upon hitting the end of the