Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/extensions/crx_installer.cc

Issue 399016: Fix race conditions where an object's constructor uses PostTask on itself. T... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 27 matching lines...) Expand all
38 ExtensionInstallUI* client) { 38 ExtensionInstallUI* client) {
39 // Note: We don't keep a reference because this object manages its own 39 // Note: We don't keep a reference because this object manages its own
40 // lifetime. 40 // lifetime.
41 CrxInstaller* installer = new CrxInstaller(crx_path, install_directory, 41 CrxInstaller* installer = new CrxInstaller(crx_path, install_directory,
42 delete_source, frontend, 42 delete_source, frontend,
43 client); 43 client);
44 installer->install_source_ = install_source; 44 installer->install_source_ = install_source;
45 installer->expected_id_ = expected_id; 45 installer->expected_id_ = expected_id;
46 installer->allow_privilege_increase_ = allow_privilege_increase; 46 installer->allow_privilege_increase_ = allow_privilege_increase;
47 47
48 installer->unpacker_ = new SandboxedExtensionUnpacker( 48 scoped_refptr<SandboxedExtensionUnpacker> unpacker(
49 installer->source_file_, g_browser_process->resource_dispatcher_host(), 49 new SandboxedExtensionUnpacker(
50 installer); 50 installer->source_file_,
51 g_browser_process->resource_dispatcher_host(),
52 installer));
51 53
52 ChromeThread::PostTask( 54 ChromeThread::PostTask(
53 ChromeThread::FILE, FROM_HERE, 55 ChromeThread::FILE, FROM_HERE,
54 NewRunnableMethod(installer->unpacker_, &SandboxedExtensionUnpacker::Start )); 56 NewRunnableMethod(
57 unpacker.get(), &SandboxedExtensionUnpacker::Start));
55 } 58 }
56 59
57 void CrxInstaller::InstallUserScript(const FilePath& source_file, 60 void CrxInstaller::InstallUserScript(const FilePath& source_file,
58 const GURL& original_url, 61 const GURL& original_url,
59 const FilePath& install_directory, 62 const FilePath& install_directory,
60 bool delete_source, 63 bool delete_source,
61 ExtensionsService* frontend, 64 ExtensionsService* frontend,
62 ExtensionInstallUI* client) { 65 ExtensionInstallUI* client) {
63 CrxInstaller* installer = new CrxInstaller(source_file, install_directory, 66 CrxInstaller* installer = new CrxInstaller(source_file, install_directory,
64 delete_source, frontend, client); 67 delete_source, frontend, client);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 client_->OnInstallSuccess(extension_.get()); 345 client_->OnInstallSuccess(extension_.get());
343 346
344 // Tell the frontend about the installation and hand off ownership of 347 // Tell the frontend about the installation and hand off ownership of
345 // extension_ to it. 348 // extension_ to it.
346 frontend_->OnExtensionInstalled(extension_.release(), 349 frontend_->OnExtensionInstalled(extension_.release(),
347 allow_privilege_increase_); 350 allow_privilege_increase_);
348 351
349 // We're done. We don't post any more tasks to ourselves so we are deleted 352 // We're done. We don't post any more tasks to ourselves so we are deleted
350 // soon. 353 // soon.
351 } 354 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698