diff options
-rw-r--r-- | base/base.gypi | 4 | ||||
-rw-r--r-- | base/file_util_win.cc | 70 | ||||
-rw-r--r-- | base/file_version_info_win.cc | 4 | ||||
-rw-r--r-- | base/platform_file_win.cc | 10 | ||||
-rw-r--r-- | base/win/registry.cc | 24 | ||||
-rw-r--r-- | base/win_util.cc | 6 | ||||
-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/save_package.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/common/chrome_version_info.cc | 3 | ||||
-rw-r--r-- | net/base/ssl_config_service_win.cc | 8 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_win.cc | 8 | ||||
-rw-r--r-- | net/url_request/url_request_file_job.cc | 8 |
16 files changed, 27 insertions, 184 deletions
diff --git a/base/base.gypi b/base/base.gypi index f9570aab..a96e5e9 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -263,8 +263,6 @@ 'thread_local_storage_posix.cc', 'thread_local_storage_win.cc', 'thread_local_win.cc', - 'thread_restrictions.h', - 'thread_restrictions.cc', 'time.cc', 'time.h', 'time_win.cc', @@ -478,6 +476,8 @@ 'sync_socket.h', 'sync_socket_win.cc', 'sync_socket_posix.cc', + 'thread_restrictions.h', + 'thread_restrictions.cc', 'time_mac.cc', 'time_posix.cc', 'version.cc', diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 4645acc..30d314f 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -19,7 +19,6 @@ #include "base/win/scoped_handle.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "base/thread_restrictions.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/win_util.h" @@ -36,8 +35,6 @@ const DWORD kFileShareAll = // Helper for NormalizeFilePath(), defined below. bool DevicePathToDriveLetterPath(const FilePath& device_path, FilePath* drive_letter_path) { - base::ThreadRestrictions::AssertIOAllowed(); - // Get the mapping of drive letters to device paths. const int kDriveMappingSize = 1024; wchar_t drive_mapping[kDriveMappingSize] = {'\0'}; @@ -78,7 +75,6 @@ bool DevicePathToDriveLetterPath(const FilePath& device_path, } // namespace std::wstring GetDirectoryFromPath(const std::wstring& path) { - base::ThreadRestrictions::AssertIOAllowed(); wchar_t path_buffer[MAX_PATH]; wchar_t* file_ptr = NULL; if (GetFullPathName(path.c_str(), MAX_PATH, path_buffer, &file_ptr) == 0) @@ -91,7 +87,6 @@ std::wstring GetDirectoryFromPath(const std::wstring& path) { } bool AbsolutePath(FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); wchar_t file_path_buf[MAX_PATH]; if (!_wfullpath(file_path_buf, path->value().c_str(), MAX_PATH)) return false; @@ -101,8 +96,6 @@ bool AbsolutePath(FilePath* path) { int CountFilesCreatedAfter(const FilePath& path, const base::Time& comparison_time) { - base::ThreadRestrictions::AssertIOAllowed(); - int file_count = 0; FILETIME comparison_filetime(comparison_time.ToFileTime()); @@ -130,8 +123,6 @@ int CountFilesCreatedAfter(const FilePath& path, } bool Delete(const FilePath& path, bool recursive) { - base::ThreadRestrictions::AssertIOAllowed(); - if (path.value().length() >= MAX_PATH) return false; @@ -170,8 +161,6 @@ bool Delete(const FilePath& path, bool recursive) { } bool DeleteAfterReboot(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); - if (path.value().length() >= MAX_PATH) return false; @@ -181,8 +170,6 @@ bool DeleteAfterReboot(const FilePath& path) { } bool Move(const FilePath& from_path, const FilePath& to_path) { - base::ThreadRestrictions::AssertIOAllowed(); - // NOTE: I suspect we could support longer paths, but that would involve // analyzing all our usage of files. if (from_path.value().length() >= MAX_PATH || @@ -202,8 +189,6 @@ bool Move(const FilePath& from_path, const FilePath& to_path) { } bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) { - base::ThreadRestrictions::AssertIOAllowed(); - // Make sure that the target file exists. HANDLE target_file = ::CreateFile( to_path.value().c_str(), @@ -223,8 +208,6 @@ bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) { } bool CopyFile(const FilePath& from_path, const FilePath& to_path) { - base::ThreadRestrictions::AssertIOAllowed(); - // NOTE: I suspect we could support longer paths, but that would involve // analyzing all our usage of files. if (from_path.value().length() >= MAX_PATH || @@ -237,8 +220,6 @@ bool CopyFile(const FilePath& from_path, const FilePath& to_path) { bool ShellCopy(const FilePath& from_path, const FilePath& to_path, bool recursive) { - base::ThreadRestrictions::AssertIOAllowed(); - // NOTE: I suspect we could support longer paths, but that would involve // analyzing all our usage of files. if (from_path.value().length() >= MAX_PATH || @@ -270,8 +251,6 @@ bool ShellCopy(const FilePath& from_path, const FilePath& to_path, bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, bool recursive) { - base::ThreadRestrictions::AssertIOAllowed(); - if (recursive) return ShellCopy(from_path, to_path, true); @@ -295,7 +274,6 @@ bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, bool CopyAndDeleteDirectory(const FilePath& from_path, const FilePath& to_path) { - base::ThreadRestrictions::AssertIOAllowed(); if (CopyDirectory(from_path, to_path, true)) { if (Delete(from_path, true)) { return true; @@ -310,12 +288,10 @@ bool CopyAndDeleteDirectory(const FilePath& from_path, bool PathExists(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES); } bool PathIsWritable(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); HANDLE dir = CreateFile(path.value().c_str(), FILE_ADD_FILE, kFileShareAll, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); @@ -328,7 +304,6 @@ bool PathIsWritable(const FilePath& path) { } bool DirectoryExists(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); DWORD fileattr = GetFileAttributes(path.value().c_str()); if (fileattr != INVALID_FILE_ATTRIBUTES) return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0; @@ -337,7 +312,6 @@ bool DirectoryExists(const FilePath& path) { bool GetFileCreationLocalTimeFromHandle(HANDLE file_handle, LPSYSTEMTIME creation_time) { - base::ThreadRestrictions::AssertIOAllowed(); if (!file_handle) return false; @@ -354,7 +328,6 @@ bool GetFileCreationLocalTimeFromHandle(HANDLE file_handle, bool GetFileCreationLocalTime(const std::wstring& filename, LPSYSTEMTIME creation_time) { - base::ThreadRestrictions::AssertIOAllowed(); base::win::ScopedHandle file_handle( CreateFile(filename.c_str(), GENERIC_READ, kFileShareAll, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); @@ -362,8 +335,6 @@ bool GetFileCreationLocalTime(const std::wstring& filename, } bool ResolveShortcut(FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); - HRESULT result; base::win::ScopedComPtr<IShellLink> i_shell_link; bool is_resolved = false; @@ -399,8 +370,6 @@ bool CreateShortcutLink(const wchar_t *source, const wchar_t *destination, const wchar_t *working_dir, const wchar_t *arguments, const wchar_t *description, const wchar_t *icon, int icon_index, const wchar_t* app_id) { - base::ThreadRestrictions::AssertIOAllowed(); - // Length of arguments and description must be less than MAX_PATH. DCHECK(lstrlen(arguments) < MAX_PATH); DCHECK(lstrlen(description) < MAX_PATH); @@ -452,8 +421,6 @@ bool UpdateShortcutLink(const wchar_t *source, const wchar_t *destination, const wchar_t *working_dir, const wchar_t *arguments, const wchar_t *description, const wchar_t *icon, int icon_index, const wchar_t* app_id) { - base::ThreadRestrictions::AssertIOAllowed(); - // Length of arguments and description must be less than MAX_PATH. DCHECK(lstrlen(arguments) < MAX_PATH); DCHECK(lstrlen(description) < MAX_PATH); @@ -500,8 +467,6 @@ bool UpdateShortcutLink(const wchar_t *source, const wchar_t *destination, } bool TaskbarPinShortcutLink(const wchar_t* shortcut) { - base::ThreadRestrictions::AssertIOAllowed(); - // "Pin to taskbar" is only supported after Win7. if (base::win::GetVersion() < base::win::VERSION_WIN7) return false; @@ -512,8 +477,6 @@ bool TaskbarPinShortcutLink(const wchar_t* shortcut) { } bool TaskbarUnpinShortcutLink(const wchar_t* shortcut) { - base::ThreadRestrictions::AssertIOAllowed(); - // "Unpin from taskbar" is only supported after Win7. if (base::win::GetVersion() < base::win::VERSION_WIN7) return false; @@ -524,8 +487,6 @@ bool TaskbarUnpinShortcutLink(const wchar_t* shortcut) { } bool GetTempDir(FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); - wchar_t temp_path[MAX_PATH + 1]; DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); if (path_len >= MAX_PATH || path_len <= 0) @@ -542,8 +503,6 @@ bool GetShmemTempDir(FilePath* path) { } bool CreateTemporaryFile(FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); - FilePath temp_file; if (!GetTempDir(path)) @@ -558,7 +517,6 @@ bool CreateTemporaryFile(FilePath* path) { } FILE* CreateAndOpenTemporaryShmemFile(FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); return CreateAndOpenTemporaryFile(path); } @@ -567,7 +525,6 @@ FILE* CreateAndOpenTemporaryShmemFile(FilePath* path) { // TODO(jrg): is there equivalent call to use on Windows instead of // going 2-step? FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); if (!CreateTemporaryFileInDir(dir, path)) { return NULL; } @@ -579,8 +536,6 @@ FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) { - base::ThreadRestrictions::AssertIOAllowed(); - wchar_t temp_name[MAX_PATH + 1]; if (!GetTempFileName(dir.value().c_str(), L"", 0, temp_name)) { @@ -603,8 +558,6 @@ bool CreateTemporaryFileInDir(const FilePath& dir, bool CreateTemporaryDirInDir(const FilePath& base_dir, const FilePath::StringType& prefix, FilePath* new_dir) { - base::ThreadRestrictions::AssertIOAllowed(); - FilePath path_to_create; srand(static_cast<uint32>(time(NULL))); @@ -629,8 +582,6 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir, bool CreateNewTempDirectory(const FilePath::StringType& prefix, FilePath* new_temp_path) { - base::ThreadRestrictions::AssertIOAllowed(); - FilePath system_temp_dir; if (!GetTempDir(&system_temp_dir)) return false; @@ -639,8 +590,6 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix, } bool CreateDirectory(const FilePath& full_path) { - base::ThreadRestrictions::AssertIOAllowed(); - // If the path exists, we've succeeded if it's a directory, failed otherwise. const wchar_t* full_path_str = full_path.value().c_str(); DWORD fileattr = ::GetFileAttributes(full_path_str); @@ -687,8 +636,6 @@ bool CreateDirectory(const FilePath& full_path) { } bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* results) { - base::ThreadRestrictions::AssertIOAllowed(); - WIN32_FILE_ATTRIBUTE_DATA attr; if (!GetFileAttributesEx(file_path.value().c_str(), GetFileExInfoStandard, &attr)) { @@ -710,18 +657,15 @@ bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* results) { } FILE* OpenFile(const FilePath& filename, const char* mode) { - base::ThreadRestrictions::AssertIOAllowed(); std::wstring w_mode = ASCIIToWide(std::string(mode)); return _wfsopen(filename.value().c_str(), w_mode.c_str(), _SH_DENYNO); } FILE* OpenFile(const std::string& filename, const char* mode) { - base::ThreadRestrictions::AssertIOAllowed(); return _fsopen(filename.c_str(), mode, _SH_DENYNO); } int ReadFile(const FilePath& filename, char* data, int size) { - base::ThreadRestrictions::AssertIOAllowed(); base::win::ScopedHandle file(CreateFile(filename.value().c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -740,7 +684,6 @@ int ReadFile(const FilePath& filename, char* data, int size) { } int WriteFile(const FilePath& filename, const char* data, int size) { - base::ThreadRestrictions::AssertIOAllowed(); base::win::ScopedHandle file(CreateFile(filename.value().c_str(), GENERIC_WRITE, 0, @@ -775,8 +718,6 @@ int WriteFile(const FilePath& filename, const char* data, int size) { bool RenameFileAndResetSecurityDescriptor(const FilePath& source_file_path, const FilePath& target_file_path) { - base::ThreadRestrictions::AssertIOAllowed(); - // The parameters to SHFileOperation must be terminated with 2 NULL chars. std::wstring source = source_file_path.value(); std::wstring target = target_file_path.value(); @@ -799,8 +740,6 @@ bool RenameFileAndResetSecurityDescriptor(const FilePath& source_file_path, // Gets the current working directory for the process. bool GetCurrentDirectory(FilePath* dir) { - base::ThreadRestrictions::AssertIOAllowed(); - wchar_t system_buffer[MAX_PATH]; system_buffer[0] = 0; DWORD len = ::GetCurrentDirectory(MAX_PATH, system_buffer); @@ -816,7 +755,6 @@ bool GetCurrentDirectory(FilePath* dir) { // Sets the current working directory for the process. bool SetCurrentDirectory(const FilePath& directory) { - base::ThreadRestrictions::AssertIOAllowed(); BOOL ret = ::SetCurrentDirectory(directory.value().c_str()); return ret != 0; } @@ -874,8 +812,6 @@ FilePath FileEnumerator::GetFilename(const FindInfo& find_info) { } FilePath FileEnumerator::Next() { - base::ThreadRestrictions::AssertIOAllowed(); - while (has_find_data_ || !pending_paths_.empty()) { if (!has_find_data_) { // The last find FindFirstFile operation is done, prepare a new one. @@ -947,8 +883,6 @@ MemoryMappedFile::MemoryMappedFile() } bool MemoryMappedFile::MapFileToMemoryInternal() { - base::ThreadRestrictions::AssertIOAllowed(); - if (file_ == INVALID_HANDLE_VALUE) return false; @@ -992,14 +926,12 @@ void MemoryMappedFile::CloseHandles() { bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, const base::Time& cutoff_time) { - base::ThreadRestrictions::AssertIOAllowed(); long result = CompareFileTime(&find_info.ftLastWriteTime, &cutoff_time.ToFileTime()); return result == 1 || result == 0; } bool NormalizeFilePath(const FilePath& path, FilePath* real_path) { - base::ThreadRestrictions::AssertIOAllowed(); FilePath mapped_file; if (!NormalizeToNativeFilePath(path, &mapped_file)) return false; @@ -1011,7 +943,6 @@ bool NormalizeFilePath(const FilePath& path, FilePath* real_path) { } bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path) { - base::ThreadRestrictions::AssertIOAllowed(); // In Vista, GetFinalPathNameByHandle() would give us the real path // from a file handle. If we ever deprecate XP, consider changing the // code below to a call to GetFinalPathNameByHandle(). The method this @@ -1067,7 +998,6 @@ bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path) { bool PreReadImage(const wchar_t* file_path, size_t size_to_read, size_t step_size) { - base::ThreadRestrictions::AssertIOAllowed(); if (base::win::GetVersion() > base::win::VERSION_XP) { // Vista+ branch. On these OSes, the forced reads through the DLL actually // slows warm starts. The solution is to sequentially read file contents diff --git a/base/file_version_info_win.cc b/base/file_version_info_win.cc index 6c69708..d1049b8 100644 --- a/base/file_version_info_win.cc +++ b/base/file_version_info_win.cc @@ -10,14 +10,12 @@ #include "base/file_version_info.h" #include "base/logging.h" #include "base/path_service.h" -#include "base/thread_restrictions.h" // This has to be last. #include <strsafe.h> FileVersionInfoWin::FileVersionInfoWin(void* data, int language, int code_page) : language_(language), code_page_(code_page) { - base::ThreadRestrictions::AssertIOAllowed(); data_.reset((char*) data); fixed_file_info_ = NULL; UINT size; @@ -45,8 +43,6 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() { // static FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( const FilePath& file_path) { - base::ThreadRestrictions::AssertIOAllowed(); - DWORD dummy; const wchar_t* path = file_path.value().c_str(); DWORD length = ::GetFileVersionInfoSize(path, &dummy); diff --git a/base/platform_file_win.cc b/base/platform_file_win.cc index 34d8e45..3aa02e8 100644 --- a/base/platform_file_win.cc +++ b/base/platform_file_win.cc @@ -6,7 +6,6 @@ #include "base/file_path.h" #include "base/logging.h" -#include "base/thread_restrictions.h" namespace base { @@ -14,8 +13,6 @@ PlatformFile CreatePlatformFile(const FilePath& name, int flags, bool* created, PlatformFileError* error_code) { - base::ThreadRestrictions::AssertIOAllowed(); - DWORD disposition = 0; if (flags & PLATFORM_FILE_OPEN) @@ -111,12 +108,10 @@ PlatformFile CreatePlatformFile(const std::wstring& name, int flags, } bool ClosePlatformFile(PlatformFile file) { - base::ThreadRestrictions::AssertIOAllowed(); return (CloseHandle(file) != 0); } int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size) { - base::ThreadRestrictions::AssertIOAllowed(); if (file == kInvalidPlatformFileValue) return -1; @@ -138,7 +133,6 @@ int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size) { int WritePlatformFile(PlatformFile file, int64 offset, const char* data, int size) { - base::ThreadRestrictions::AssertIOAllowed(); if (file == kInvalidPlatformFileValue) return -1; @@ -157,7 +151,6 @@ int WritePlatformFile(PlatformFile file, int64 offset, } bool TruncatePlatformFile(PlatformFile file, int64 length) { - base::ThreadRestrictions::AssertIOAllowed(); if (file == kInvalidPlatformFileValue) return false; @@ -183,13 +176,11 @@ bool TruncatePlatformFile(PlatformFile file, int64 length) { } bool FlushPlatformFile(PlatformFile file) { - base::ThreadRestrictions::AssertIOAllowed(); return ((file != kInvalidPlatformFileValue) && ::FlushFileBuffers(file)); } bool TouchPlatformFile(PlatformFile file, const base::Time& last_access_time, const base::Time& last_modified_time) { - base::ThreadRestrictions::AssertIOAllowed(); if (file == kInvalidPlatformFileValue) return false; @@ -200,7 +191,6 @@ bool TouchPlatformFile(PlatformFile file, const base::Time& last_access_time, } bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info) { - base::ThreadRestrictions::AssertIOAllowed(); if (!info) return false; diff --git a/base/win/registry.cc b/base/win/registry.cc index 977ea00..545c337 100644 --- a/base/win/registry.cc +++ b/base/win/registry.cc @@ -7,7 +7,6 @@ #include <shlwapi.h> #include "base/logging.h" -#include "base/thread_restrictions.h" #pragma comment(lib, "shlwapi.lib") // for SHDeleteKey @@ -16,8 +15,6 @@ namespace win { RegistryValueIterator::RegistryValueIterator(HKEY root_key, const wchar_t* folder_key) { - base::ThreadRestrictions::AssertIOAllowed(); - LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_); if (result != ERROR_SUCCESS) { key_ = NULL; @@ -38,7 +35,6 @@ RegistryValueIterator::RegistryValueIterator(HKEY root_key, } RegistryValueIterator::~RegistryValueIterator() { - base::ThreadRestrictions::AssertIOAllowed(); if (key_) ::RegCloseKey(key_); } @@ -53,7 +49,6 @@ void RegistryValueIterator::operator++() { } bool RegistryValueIterator::Read() { - base::ThreadRestrictions::AssertIOAllowed(); if (Valid()) { DWORD ncount = arraysize(name_); value_size_ = sizeof(value_); @@ -70,7 +65,6 @@ bool RegistryValueIterator::Read() { } DWORD RegistryValueIterator::ValueCount() const { - base::ThreadRestrictions::AssertIOAllowed(); DWORD count = 0; HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL); @@ -83,7 +77,6 @@ DWORD RegistryValueIterator::ValueCount() const { RegistryKeyIterator::RegistryKeyIterator(HKEY root_key, const wchar_t* folder_key) { - base::ThreadRestrictions::AssertIOAllowed(); LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_); if (result != ERROR_SUCCESS) { key_ = NULL; @@ -104,7 +97,6 @@ RegistryKeyIterator::RegistryKeyIterator(HKEY root_key, } RegistryKeyIterator::~RegistryKeyIterator() { - base::ThreadRestrictions::AssertIOAllowed(); if (key_) ::RegCloseKey(key_); } @@ -119,7 +111,6 @@ void RegistryKeyIterator::operator++() { } bool RegistryKeyIterator::Read() { - base::ThreadRestrictions::AssertIOAllowed(); if (Valid()) { DWORD ncount = arraysize(name_); FILETIME written; @@ -134,7 +125,6 @@ bool RegistryKeyIterator::Read() { } DWORD RegistryKeyIterator::SubkeyCount() const { - base::ThreadRestrictions::AssertIOAllowed(); DWORD count = 0; HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, &count, NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -153,7 +143,6 @@ RegKey::RegKey() RegKey::RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access) : key_(NULL), watch_event_(0) { - base::ThreadRestrictions::AssertIOAllowed(); if (rootkey) { if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) Create(rootkey, subkey, access); @@ -169,7 +158,6 @@ RegKey::~RegKey() { } void RegKey::Close() { - base::ThreadRestrictions::AssertIOAllowed(); StopWatching(); if (key_) { ::RegCloseKey(key_); @@ -184,7 +172,6 @@ bool RegKey::Create(HKEY rootkey, const wchar_t* subkey, REGSAM access) { bool RegKey::CreateWithDisposition(HKEY rootkey, const wchar_t* subkey, DWORD* disposition, REGSAM access) { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(rootkey && subkey && access && disposition); Close(); @@ -206,7 +193,6 @@ bool RegKey::CreateWithDisposition(HKEY rootkey, const wchar_t* subkey, } bool RegKey::Open(HKEY rootkey, const wchar_t* subkey, REGSAM access) { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(rootkey && subkey && access); Close(); @@ -219,7 +205,6 @@ bool RegKey::Open(HKEY rootkey, const wchar_t* subkey, REGSAM access) { } bool RegKey::CreateKey(const wchar_t* name, REGSAM access) { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(name && access); HKEY subkey = NULL; @@ -232,7 +217,6 @@ bool RegKey::CreateKey(const wchar_t* name, REGSAM access) { } bool RegKey::OpenKey(const wchar_t* name, REGSAM access) { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(name && access); HKEY subkey = NULL; @@ -245,7 +229,6 @@ bool RegKey::OpenKey(const wchar_t* name, REGSAM access) { } DWORD RegKey::ValueCount() { - base::ThreadRestrictions::AssertIOAllowed(); DWORD count = 0; HRESULT result = RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL); @@ -253,7 +236,6 @@ DWORD RegKey::ValueCount() { } bool RegKey::ReadName(int index, std::wstring* name) { - base::ThreadRestrictions::AssertIOAllowed(); wchar_t buf[256]; DWORD bufsize = arraysize(buf); LRESULT r = ::RegEnumValue(key_, index, buf, &bufsize, NULL, NULL, @@ -266,7 +248,6 @@ bool RegKey::ReadName(int index, std::wstring* name) { } bool RegKey::ValueExists(const wchar_t* name) { - base::ThreadRestrictions::AssertIOAllowed(); if (!key_) return false; HRESULT result = RegQueryValueEx(key_, name, 0, NULL, NULL, NULL); @@ -275,7 +256,6 @@ bool RegKey::ValueExists(const wchar_t* name) { bool RegKey::ReadValue(const wchar_t* name, void* data, DWORD* dsize, DWORD* dtype) { - base::ThreadRestrictions::AssertIOAllowed(); if (!key_) return false; HRESULT result = RegQueryValueEx(key_, name, 0, dtype, @@ -284,7 +264,6 @@ bool RegKey::ReadValue(const wchar_t* name, void* data, } bool RegKey::ReadValue(const wchar_t* name, std::wstring* value) { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(value); const size_t kMaxStringLength = 1024; // This is after expansion. // Use the one of the other forms of ReadValue if 1024 is too small for you. @@ -329,7 +308,6 @@ bool RegKey::ReadValueDW(const wchar_t* name, DWORD* value) { bool RegKey::WriteValue(const wchar_t* name, const void * data, DWORD dsize, DWORD dtype) { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(data); if (!key_) @@ -356,12 +334,10 @@ bool RegKey::WriteValue(const wchar_t* name, DWORD value) { } bool RegKey::DeleteKey(const wchar_t* name) { - base::ThreadRestrictions::AssertIOAllowed(); return (!key_) ? false : (ERROR_SUCCESS == SHDeleteKey(key_, name)); } bool RegKey::DeleteValue(const wchar_t* value_name) { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(value_name); HRESULT result = RegDeleteValue(key_, value_name); return (result == ERROR_SUCCESS); diff --git a/base/win_util.cc b/base/win_util.cc index 3fcfb92..a576122 100644 --- a/base/win_util.cc +++ b/base/win_util.cc @@ -17,7 +17,6 @@ #include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/stringprintf.h" -#include "base/thread_restrictions.h" #include "base/win/windows_version.h" namespace win_util { @@ -128,11 +127,6 @@ std::wstring GetClassName(HWND window) { } bool UserAccountControlIsEnabled() { - // This can be slow if Windows ends up going to disk. Should watch this key - // for changes and only read it once, preferably on the file thread. - // http://code.google.com/p/chromium/issues/detail?id=61644 - base::ThreadRestrictions::ScopedAllowIO allow_io; - base::win::RegKey key(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", KEY_READ); diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 446bca6..bf4d385 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -376,19 +376,13 @@ void Browser::CreateBrowserWindow() { window_ = BrowserWindow::CreateBrowserWindow(this); #if defined(OS_WIN) - { - // 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()); - } + // 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 2452da3..9e33f68 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -483,7 +483,7 @@ void HandleTestParameters(const CommandLine& command_line) { void RunUIMessageLoop(BrowserProcess* browser_process) { TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, ""); -#if !defined(OS_CHROMEOS) +#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) // 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 2c51470..43257a2 100644 --- a/chrome/browser/dom_ui/shared_resources_data_source.cc +++ b/chrome/browser/dom_ui/shared_resources_data_source.cc @@ -6,7 +6,6 @@ #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" @@ -80,11 +79,6 @@ 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/save_package.cc b/chrome/browser/download/save_package.cc index d637cda..473a795 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -13,7 +13,6 @@ #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" @@ -1159,10 +1158,6 @@ 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(); @@ -1179,10 +1174,6 @@ 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/io_thread.cc b/chrome/browser/io_thread.cc index 9f40c50..55713b7 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_CHROMEOS) +#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) // 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 e49c463..e30970c 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -110,7 +110,6 @@ #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,19 +2026,25 @@ void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { DCHECK(!plugin_path.value().empty()); std::wstring plugin_name = plugin_path.ToWStringHack(); - 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_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; #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/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc index 5157c4a..a26f81f 100644 --- a/chrome/common/chrome_version_info.cc +++ b/chrome/common/chrome_version_info.cc @@ -7,7 +7,6 @@ #include "base/basictypes.h" #include "base/file_version_info.h" #include "base/string_util.h" -#include "base/thread_restrictions.h" #include "build/build_config.h" namespace chrome { @@ -17,8 +16,6 @@ namespace chrome { // FileVersionInfo for the current module. VersionInfo::VersionInfo() { - // The current module is already loaded in memory, so this will be cheap. - base::ThreadRestrictions::ScopedAllowIO allow_io; version_info_.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule()); } diff --git a/net/base/ssl_config_service_win.cc b/net/base/ssl_config_service_win.cc index debea7d..14c4d24 100644 --- a/net/base/ssl_config_service_win.cc +++ b/net/base/ssl_config_service_win.cc @@ -4,7 +4,6 @@ #include "net/base/ssl_config_service_win.h" -#include "base/thread_restrictions.h" #include "base/win/registry.h" using base::TimeDelta; @@ -60,9 +59,6 @@ void SSLConfigServiceWin::GetSSLConfigAt(SSLConfig* config, TimeTicks now) { // static bool SSLConfigServiceWin::GetSSLConfigNow(SSLConfig* config) { - // This registry access goes to disk and will slow down the IO thread. - // http://crbug.com/61455 - base::ThreadRestrictions::ScopedAllowIO allow_io; RegKey internet_settings; if (!internet_settings.Open(HKEY_CURRENT_USER, kInternetSettingsSubKeyName, KEY_READ)) @@ -87,8 +83,6 @@ bool SSLConfigServiceWin::GetSSLConfigNow(SSLConfig* config) { // static void SSLConfigServiceWin::SetRevCheckingEnabled(bool enabled) { - // This registry access goes to disk and will slow down the IO thread. - // http://crbug.com/61455 DWORD value = enabled; RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName, KEY_WRITE); @@ -114,8 +108,6 @@ void SSLConfigServiceWin::SetTLS1Enabled(bool enabled) { // static void SSLConfigServiceWin::SetSSLVersionEnabled(int version, bool enabled) { - // This registry access goes to disk and will slow down the IO thread. - // http://crbug.com/61455 RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName, KEY_READ | KEY_WRITE); DWORD value; diff --git a/net/proxy/proxy_config_service_win.cc b/net/proxy/proxy_config_service_win.cc index 5aca4ae..d0a387f 100644 --- a/net/proxy/proxy_config_service_win.cc +++ b/net/proxy/proxy_config_service_win.cc @@ -12,7 +12,6 @@ #include "base/string_tokenizer.h" #include "base/string_util.h" #include "base/stl_util-inl.h" -#include "base/thread_restrictions.h" #include "base/win/registry.h" #include "net/base/net_errors.h" #include "net/proxy/proxy_config.h" @@ -73,9 +72,6 @@ ProxyConfigServiceWin::ProxyConfigServiceWin() } ProxyConfigServiceWin::~ProxyConfigServiceWin() { - // The registry functions below will end up going to disk. Do this on another - // thread to avoid slowing the IO thread. http://crbug.com/61453 - base::ThreadRestrictions::ScopedAllowIO allow_io; STLDeleteElements(&keys_to_watch_); } @@ -91,10 +87,6 @@ void ProxyConfigServiceWin::StartWatchingRegistryForChanges() { if (!keys_to_watch_.empty()) return; // Already initialized. - // The registry functions below will end up going to disk. Do this on another - // thread to avoid slowing the IO thread. http://crbug.com/61453 - base::ThreadRestrictions::ScopedAllowIO allow_io; - // There are a number of different places where proxy settings can live // in the registry. In some cases it appears in a binary value, in other // cases string values. Furthermore winhttp and wininet appear to have diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index fff85c3..f9c6559 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -203,10 +203,6 @@ bool URLRequestFileJob::GetContentEncodings( } bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { - // URL 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; DCHECK(request_); return net::GetMimeTypeFromFile(file_path_, mime_type); } @@ -256,10 +252,6 @@ void URLRequestFileJob::DidResolve( if (!exists) { rv = net::ERR_FILE_NOT_FOUND; } else if (!is_directory_) { - // URL requests should not block on the disk! - // http://code.google.com/p/chromium/issues/detail?id=59849 - base::ThreadRestrictions::ScopedAllowIO allow_io; - int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | base::PLATFORM_FILE_ASYNC; |