diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 03:40:34 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 03:40:34 +0000 |
commit | 765b7ea55adbd405265c5e87a7901978aba1e8d3 (patch) | |
tree | cd41255e689f30e2c23d00420dc0b391ebd34eb7 /chrome | |
parent | fe098f782d2f25f156d6b0ded5677c804517ae85 (diff) | |
download | chromium_src-765b7ea55adbd405265c5e87a7901978aba1e8d3.zip chromium_src-765b7ea55adbd405265c5e87a7901978aba1e8d3.tar.gz chromium_src-765b7ea55adbd405265c5e87a7901978aba1e8d3.tar.bz2 |
Makes deletion of ExtensionInstallUI happen on ui thread.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1578003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/extensions/crx_installer.cc | 14 | ||||
-rw-r--r-- | chrome/browser/extensions/crx_installer.h | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index c342a3d..e10c534 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -61,6 +61,10 @@ CrxInstaller::~CrxInstaller() { ChromeThread::FILE, FROM_HERE, NewRunnableFunction(&DeleteFileHelper, source_file_, false)); } + + // Make sure the UI is deleted on the ui thread. + ChromeThread::DeleteSoon(ChromeThread::UI, FROM_HERE, client_); + client_ = NULL; } void CrxInstaller::InstallCrx(const FilePath& source_file) { @@ -142,7 +146,7 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, return; } - if (client_.get() || extension_->GetFullLaunchURL().is_valid()) { + if (client_ || extension_->GetFullLaunchURL().is_valid()) { Extension::DecodeIcon(extension_.get(), Extension::EXTENSION_ICON_LARGE, &install_icon_); } @@ -164,7 +168,7 @@ void CrxInstaller::ConfirmInstall() { current_version_ = frontend_->extension_prefs()->GetVersionString(extension_->id()); - if (client_.get()) { + if (client_) { AddRef(); // Balanced in Proceed() and Abort(). client_->ConfirmInstall(this, extension_.get()); } else { @@ -282,7 +286,7 @@ void CrxInstaller::ReportFailureFromUIThread(const std::string& error) { // rid of this line. ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet - if (client_.get()) + if (client_) client_->OnInstallFailure(error); } @@ -301,7 +305,7 @@ void CrxInstaller::ReportOverinstallFromUIThread() { Source<CrxInstaller>(this), Details<const FilePath>(&extension_->path())); - if (client_.get()) + if (client_) client_->OnOverinstallAttempted(extension_.get()); frontend_->OnExtensionOverinstallAttempted(extension_->id()); @@ -318,7 +322,7 @@ void CrxInstaller::ReportSuccessFromUIThread() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); // If there is a client, tell the client about installation. - if (client_.get()) + if (client_) client_->OnInstallSuccess(extension_.get()); // Tell the frontend about the installation and hand off ownership of diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index bb109c2..80f0347 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -182,7 +182,9 @@ class CrxInstaller // The client we will work with to do the installation. This can be NULL, in // which case the install is silent. - scoped_ptr<ExtensionInstallUI> client_; + // NOTE: we may be deleted on the file thread. To ensure the UI is deleted on + // the main thread we don't use a scoped_ptr here. + ExtensionInstallUI* client_; // The root of the unpacked extension directory. This is a subdirectory of // temp_dir_, so we don't have to delete it explicitly. |