diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 17:41:00 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 17:41:00 +0000 |
commit | 45446a5e18df7910f64a690a5d6389b70e30f985 (patch) | |
tree | 5318a1c6e14aa8600a2d958929da77019d1ef4a8 /chrome/browser | |
parent | 42d5be693f7cc623caa3df6bfb2bcc4f6861cb36 (diff) | |
download | chromium_src-45446a5e18df7910f64a690a5d6389b70e30f985.zip chromium_src-45446a5e18df7910f64a690a5d6389b70e30f985.tar.gz chromium_src-45446a5e18df7910f64a690a5d6389b70e30f985.tar.bz2 |
Turn on file access checks on Win.
BUG=60211
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=64960
Review URL: http://codereview.chromium.org/4222005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser.cc | 20 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 2 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shared_resources_data_source.cc | 6 | ||||
-rw-r--r-- | chrome/browser/download/download_util.cc | 8 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 9 | ||||
-rw-r--r-- | chrome/browser/extensions/sandboxed_extension_unpacker.cc | 9 | ||||
-rw-r--r-- | chrome/browser/io_thread.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 27 | ||||
-rw-r--r-- | chrome/browser/themes/browser_theme_pack.cc | 5 |
9 files changed, 61 insertions, 27 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index bf4d385..446bca6 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -376,13 +376,19 @@ void Browser::CreateBrowserWindow() { window_ = BrowserWindow::CreateBrowserWindow(this); #if defined(OS_WIN) - // Set the app user model id for this application to that of the application - // name. See http://crbug.com/7028. - win_util::SetAppIdForWindow( - type_ & TYPE_APP ? - ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : - ShellIntegration::GetChromiumAppId(profile_->GetPath()), - window()->GetNativeHandle()); + { + // TODO: This might hit the disk + // http://code.google.com/p/chromium/issues/detail?id=61638 + base::ThreadRestrictions::ScopedAllowIO allow_io; + + // Set the app user model id for this application to that of the application + // name. See http://crbug.com/7028. + win_util::SetAppIdForWindow( + type_ & TYPE_APP ? + ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : + ShellIntegration::GetChromiumAppId(profile_->GetPath()), + window()->GetNativeHandle()); + } #endif NotificationService::current()->Notify( diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 64f4558..036c33a 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -484,7 +484,7 @@ void HandleTestParameters(const CommandLine& command_line) { void RunUIMessageLoop(BrowserProcess* browser_process) { TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, ""); -#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) +#if !defined(OS_CHROMEOS) // If the UI thread blocks, the whole UI is unresponsive. // Do not allow disk IO from the UI thread. // TODO(evanm): turn this on for all platforms. diff --git a/chrome/browser/dom_ui/shared_resources_data_source.cc b/chrome/browser/dom_ui/shared_resources_data_source.cc index 43257a2..2c51470 100644 --- a/chrome/browser/dom_ui/shared_resources_data_source.cc +++ b/chrome/browser/dom_ui/shared_resources_data_source.cc @@ -6,6 +6,7 @@ #include "app/resource_bundle.h" #include "base/singleton.h" +#include "base/thread_restrictions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" @@ -79,6 +80,11 @@ void SharedResourcesDataSource::StartDataRequest(const std::string& path, std::string SharedResourcesDataSource::GetMimeType( const std::string& path) const { + // Requests should not block on the disk! On Windows this goes to the + // registry. + // http://code.google.com/p/chromium/issues/detail?id=59849 + base::ThreadRestrictions::ScopedAllowIO allow_io; + std::string mime_type; net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); return mime_type; diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index affa24a1..8c0331e 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -21,6 +21,7 @@ #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/sys_string_conversions.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "base/win/windows_version.h" @@ -150,8 +151,13 @@ void GenerateExtension(const FilePath& file_name, extension.assign(default_extension); #endif - if (extension.empty()) + if (extension.empty()) { + // The GetPreferredExtensionForMimeType call will end up going to disk. Do + // this on another thread to avoid slowing the IO thread. + // http://crbug.com/61827 + base::ThreadRestrictions::ScopedAllowIO allow_io; net::GetPreferredExtensionForMimeType(mime_type, &extension); + } generated_extension->swap(extension); } diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 473a795..d637cda 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -13,6 +13,7 @@ #include "base/stl_util-inl.h" #include "base/string_piece.h" #include "base/string_split.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" #include "base/task.h" #include "base/thread.h" @@ -1158,6 +1159,10 @@ FilePath SavePackage::GetSuggestedNameForSaveAs( } FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) { + // The GetMimeTypeFromExtension call will end up going to disk. Do this on + // another thread to avoid slowing the UI thread. http://crbug.com/61775 + base::ThreadRestrictions::ScopedAllowIO allow_io; + // If the file name doesn't have an extension suitable for HTML files, // append one. FilePath::StringType ext = name.Extension(); @@ -1174,6 +1179,10 @@ FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) { FilePath SavePackage::EnsureMimeExtension(const FilePath& name, const FilePath::StringType& contents_mime_type) { + // The GetMimeTypeFromExtension call will end up going to disk. Do this on + // another thread to avoid slowing the UI thread. http://crbug.com/61775 + base::ThreadRestrictions::ScopedAllowIO allow_io; + // Start extension at 1 to skip over period if non-empty. FilePath::StringType ext = name.Extension().length() ? name.Extension().substr(1) : name.Extension(); diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index ea5ec64..48daa6a 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -12,6 +12,7 @@ #include "base/message_loop.h" #include "base/scoped_handle.h" #include "base/task.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" // TODO(viettrungluu): delete me. #include "chrome/browser/browser_thread.h" #include "chrome/browser/extensions/extensions_service.h" @@ -116,7 +117,13 @@ void SandboxedExtensionUnpacker::Start() { } } -SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() {} +SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() { + // temp_dir_'s destructor will delete a directory on the file thread. Do + // this on another thread to avoid slowing the UI thread. + // http://crbug.com/61922 + base::ThreadRestrictions::ScopedAllowIO allow_io; + temp_dir_.Delete(); +} void SandboxedExtensionUnpacker::StartProcessOnIOThread( const FilePath& temp_crx_path) { diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 55713b7..9f40c50 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -257,7 +257,7 @@ net::ProxyScriptFetcher* IOThread::CreateAndRegisterProxyScriptFetcher( } void IOThread::Init() { -#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) +#if !defined(OS_CHROMEOS) // TODO(evan): test and enable this on all platforms. // Though this thread is called the "IO" thread, it actually just routes // messages around; it shouldn't be allowed to perform any blocking disk I/O. diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 2fb3ccc..4a46eb3 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -110,6 +110,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebView.h" #include "webkit/glue/webpreferences.h" #include "webkit/glue/password_form.h" +#include "webkit/glue/plugins/plugin_list.h" // Cross-Site Navigations // @@ -2027,25 +2028,19 @@ void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { DCHECK(!plugin_path.value().empty()); std::wstring plugin_name = plugin_path.ToWStringHack(); -#if defined(OS_WIN) || defined(OS_MACOSX) - scoped_ptr<FileVersionInfo> version_info( - FileVersionInfo::CreateFileVersionInfo(plugin_path)); - if (version_info.get()) { - const std::wstring& product_name = version_info->product_name(); - if (!product_name.empty()) { - plugin_name = product_name; + WebPluginInfo plugin_info; + if (NPAPI::PluginList::Singleton()->GetPluginInfoByPath( + plugin_path, &plugin_info) && + !plugin_info.name.empty()) { + plugin_name = UTF16ToWide(plugin_info.name); #if defined(OS_MACOSX) - // Many plugins on the Mac have .plugin in the actual name, which looks - // terrible, so look for that and strip it off if present. - const std::wstring plugin_extension(L".plugin"); - if (EndsWith(plugin_name, plugin_extension, true)) - plugin_name.erase(plugin_name.length() - plugin_extension.length()); + // Many plugins on the Mac have .plugin in the actual name, which looks + // terrible, so look for that and strip it off if present. + const std::wstring plugin_extension(L".plugin"); + if (EndsWith(plugin_name, plugin_extension, true)) + plugin_name.erase(plugin_name.length() - plugin_extension.length()); #endif // OS_MACOSX - } } -#else - NOTIMPLEMENTED() << " convert plugin path to plugin name"; -#endif SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_INFOBAR_PLUGIN_CRASHED); AddInfoBar(new SimpleAlertInfoBarDelegate( diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index c0b0081..c636b94 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -8,6 +8,7 @@ #include "base/data_pack.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_thread.h" @@ -842,6 +843,10 @@ void BrowserThemePack::BuildSourceImagesArray(const FilePathMap& file_paths) { bool BrowserThemePack::LoadRawBitmapsTo( const FilePathMap& file_paths, ImageCache* raw_bitmaps) { + // Themes should be loaded on the file thread, not the UI thread. + // http://crbug.com/61838 + base::ThreadRestrictions::ScopedAllowIO allow_io; + for (FilePathMap::const_iterator it = file_paths.begin(); it != file_paths.end(); ++it) { scoped_refptr<RefCountedMemory> raw_data(ReadFileData(it->second)); |