Fixes minor nits in Instant.
Perfcrastination:
- Adhere to the style guide with respect to DCHECKs: Either remove them
if they are not "must be true", or remove the "if (!...)" handlers.
- Disallow the default constructor in most places.
- Let the unload handler live across Instant pref changes (so that tabs
are not prematurely destroyed).
- Delay-destruct objects whose methods are callers are on the stack.
BUG=none
[email protected]
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10989062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159247 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
index 376aaf1..1fd3e3f 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -28,7 +28,8 @@
// BrowserInstantController, public:
BrowserInstantController::BrowserInstantController(Browser* browser)
- : browser_(browser) {
+ : browser_(browser),
+ instant_unload_handler_(new InstantUnloadHandler(browser)) {
profile_pref_registrar_.Init(browser_->profile()->GetPrefs());
profile_pref_registrar_.Add(prefs::kInstantEnabled, this);
ResetInstant();
@@ -37,6 +38,7 @@
BrowserInstantController::~BrowserInstantController() {
browser_->tab_strip_model()->RemoveObserver(this);
+ delete instant_unload_handler_;
}
bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) {
@@ -153,8 +155,6 @@
!browser_shutdown::ShuttingDownWithoutClosingBrowsers() &&
browser_->is_type_tabbed() ?
InstantController::CreateInstant(browser_->profile(), this) : NULL);
- instant_unload_handler_.reset(instant() ?
- new InstantUnloadHandler(browser_) : NULL);
}
} // namespace chrome