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

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

Issue 4146004: ThreadRestrictions: disallow blocking IO on the UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/singleton.h" 12 #include "base/singleton.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/task.h" 14 #include "base/task.h"
15 #include "base/thread_restrictions.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #include "base/version.h" 17 #include "base/version.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/browser_thread.h" 19 #include "chrome/browser/browser_thread.h"
19 #include "chrome/browser/extensions/convert_user_script.h" 20 #include "chrome/browser/extensions/convert_user_script.h"
20 #include "chrome/browser/extensions/extensions_service.h" 21 #include "chrome/browser/extensions/extensions_service.h"
21 #include "chrome/browser/extensions/extension_error_reporter.h" 22 #include "chrome/browser/extensions/extension_error_reporter.h"
22 #include "chrome/browser/profile.h" 23 #include "chrome/browser/profile.h"
23 #include "chrome/browser/shell_integration.h" 24 #include "chrome/browser/shell_integration.h"
24 #include "chrome/browser/web_applications/web_app.h" 25 #include "chrome/browser/web_applications/web_app.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 // Make sure the UI is deleted on the ui thread. 107 // Make sure the UI is deleted on the ui thread.
107 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_); 108 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, client_);
108 client_ = NULL; 109 client_ = NULL;
109 } 110 }
110 111
111 void CrxInstaller::InstallCrx(const FilePath& source_file) { 112 void CrxInstaller::InstallCrx(const FilePath& source_file) {
112 source_file_ = source_file; 113 source_file_ = source_file;
113 114
114 FilePath user_data_temp_dir; 115 FilePath user_data_temp_dir;
115 CHECK(PathService::Get(chrome::DIR_USER_DATA_TEMP, &user_data_temp_dir)); 116 {
117 // We shouldn't be doing disk IO on the UI thread.
118 // http://code.google.com/p/chromium/issues/detail?id=60634
119 base::ThreadRestrictions::ScopedAllowIO allow_io;
120 CHECK(PathService::Get(chrome::DIR_USER_DATA_TEMP, &user_data_temp_dir));
121 }
116 122
117 scoped_refptr<SandboxedExtensionUnpacker> unpacker( 123 scoped_refptr<SandboxedExtensionUnpacker> unpacker(
118 new SandboxedExtensionUnpacker( 124 new SandboxedExtensionUnpacker(
119 source_file, 125 source_file,
120 user_data_temp_dir, 126 user_data_temp_dir,
121 g_browser_process->resource_dispatcher_host(), 127 g_browser_process->resource_dispatcher_host(),
122 this)); 128 this));
123 129
124 BrowserThread::PostTask( 130 BrowserThread::PostTask(
125 BrowserThread::FILE, FROM_HERE, 131 BrowserThread::FILE, FROM_HERE,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 client_->OnInstallSuccess(extension_.get()); 405 client_->OnInstallSuccess(extension_.get());
400 406
401 // Tell the frontend about the installation and hand off ownership of 407 // Tell the frontend about the installation and hand off ownership of
402 // extension_ to it. 408 // extension_ to it.
403 frontend_->OnExtensionInstalled(extension_.release(), 409 frontend_->OnExtensionInstalled(extension_.release(),
404 allow_privilege_increase_); 410 allow_privilege_increase_);
405 411
406 // We're done. We don't post any more tasks to ourselves so we are deleted 412 // We're done. We don't post any more tasks to ourselves so we are deleted
407 // soon. 413 // soon.
408 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698