Chromium Code Reviews| Index: chrome/browser/profiles/profile_window.cc |
| diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc |
| index 5dc41915e9792b8904908149f3316f0e56e14f81..7292f73a300dfa87643dd90d40888494cf6bdb1c 100644 |
| --- a/chrome/browser/profiles/profile_window.cc |
| +++ b/chrome/browser/profiles/profile_window.cc |
| @@ -43,6 +43,7 @@ class BrowserAddedObserver : public chrome::BrowserListObserver { |
| virtual void OnBrowserAdded(Browser* browser) OVERRIDE { |
|
Alexei Svitkine (slow)
2014/02/06 22:02:12
I think this should check for the profile of the b
noms (inactive)
2014/02/06 22:51:34
Done.
|
| DCHECK(!callback_.is_null()); |
|
Alexei Svitkine (slow)
2014/02/06 22:02:12
This check should probably be in the ctor.
noms (inactive)
2014/02/06 22:51:34
Done.
|
| callback_.Run(); |
|
Alexei Svitkine (slow)
2014/02/06 22:02:12
I think this should unregister itself as an observ
noms (inactive)
2014/02/06 22:51:34
Done.
|
| + base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| } |
| profiles::ProfileSwitchingDoneCallback callback_; |
| @@ -93,10 +94,14 @@ void OpenBrowserWindowForProfile( |
| } |
| // If there is a callback, create an observer to make sure it is only |
| - // run when the browser has been completely created. |
| - scoped_ptr<BrowserAddedObserver> browser_added_observer; |
| + // run when the browser has been completely created. This observer will |
| + // delete itself that happens. This should not leak, because we are passing |
|
Alexei Svitkine (slow)
2014/02/06 22:02:12
Missing a word after "delete itself".
noms (inactive)
2014/02/06 22:51:34
Done.
|
| + // |always_create| = true to FindOrCreateNewWindow below, which ends up |
| + // calling LaunchBrowser and opens a new window. If for whatever reason that |
| + // fails, either something has crashed, or the observer will be cleaned up |
| + // when a different browser is opened. |
| if (!callback.is_null()) |
| - browser_added_observer.reset(new BrowserAddedObserver(callback)); |
| + new BrowserAddedObserver(callback); |
| // We already dealt with the case when |always_create| was false and a browser |
| // existed, which means that here a browser definitely needs to be created. |