diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-12 21:53:16 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-12 21:53:16 +0000 |
commit | be13068b97a3aac41cad8a77f1b8626b29aaa934 (patch) | |
tree | 082bc2f007d41f6c79e5675a16d5c0f914ca8643 | |
parent | a6152af0508075b978b4f73e1bd74f0e8cd3bb7f (diff) | |
download | chromium_src-be13068b97a3aac41cad8a77f1b8626b29aaa934.zip chromium_src-be13068b97a3aac41cad8a77f1b8626b29aaa934.tar.gz chromium_src-be13068b97a3aac41cad8a77f1b8626b29aaa934.tar.bz2 |
ThreadRestrictions: mark library loading functions as doing IO
Remove the hack we used for checking that plugins didn't
regress, as this is a generalization of that idea.
Review URL: http://codereview.chromium.org/4161004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66003 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/native_library.h | 2 | ||||
-rw-r--r-- | base/native_library_linux.cc | 4 | ||||
-rw-r--r-- | base/native_library_mac.mm | 2 | ||||
-rw-r--r-- | base/native_library_win.cc | 4 | ||||
-rw-r--r-- | chrome/browser/plugin_service.cc | 8 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.cc | 10 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.h | 5 |
7 files changed, 11 insertions, 24 deletions
diff --git a/base/native_library.h b/base/native_library.h index 2bb8497..a83f68a 100644 --- a/base/native_library.h +++ b/base/native_library.h @@ -19,7 +19,7 @@ #include "base/string16.h" -// Macro usefull for writing cross-platform function pointers. +// Macro useful for writing cross-platform function pointers. #if defined(OS_WIN) && !defined(CDECL) #define CDECL __cdecl #else diff --git a/base/native_library_linux.cc b/base/native_library_linux.cc index b6d7aef..d5ab128 100644 --- a/base/native_library_linux.cc +++ b/base/native_library_linux.cc @@ -8,12 +8,16 @@ #include "base/file_path.h" #include "base/logging.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" namespace base { // static NativeLibrary LoadNativeLibrary(const FilePath& library_path) { + // dlopen() opens the file off disk. + base::ThreadRestrictions::AssertIOAllowed(); + // We deliberately do not use RTLD_DEEPBIND. For the history why, please // refer to the bug tracker. Some useful bug reports to read include: // http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892, diff --git a/base/native_library_mac.mm b/base/native_library_mac.mm index 95cac15..b17aaa6 100644 --- a/base/native_library_mac.mm +++ b/base/native_library_mac.mm @@ -11,12 +11,14 @@ #include "base/file_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/string_util.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" namespace base { // static NativeLibrary LoadNativeLibrary(const FilePath& library_path) { + // dlopen() etc. open the file off disk. if (library_path.Extension() == "dylib" || !file_util::DirectoryExists(library_path)) { void* dylib = dlopen(library_path.value().c_str(), RTLD_LAZY); diff --git a/base/native_library_win.cc b/base/native_library_win.cc index 94e4b63..b498eba 100644 --- a/base/native_library_win.cc +++ b/base/native_library_win.cc @@ -7,12 +7,16 @@ #include <windows.h> #include "base/file_util.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" namespace base { // static NativeLibrary LoadNativeLibrary(const FilePath& library_path) { + // LoadLibrary() opens the file off disk. + base::ThreadRestrictions::AssertIOAllowed(); + // Switch the current directory to the library directory as the library // may have dependencies on DLLs in this directory. bool restore_directory = false; diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index cc6408f..bd37a6f 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -60,18 +60,10 @@ static void NotifyPluginsOfActivation() { // static bool PluginService::enable_chrome_plugins_ = true; -void LoadPluginsFromDiskHook() { - DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI) && - !BrowserThread::CurrentlyOn(BrowserThread::IO)) << - "Can't load plugins on the IO/UI threads since it's very slow."; -} - // static void PluginService::InitGlobalInstance(Profile* profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - NPAPI::PluginList::Singleton()->SetPluginLoadHook(LoadPluginsFromDiskHook); - // We first group the plugins and then figure out which groups to disable. PluginUpdater::GetPluginUpdater()->DisablePluginGroupsFromPrefs(profile); diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc index 4b3ce27..84736cb 100644 --- a/webkit/glue/plugins/plugin_list.cc +++ b/webkit/glue/plugins/plugin_list.cc @@ -24,19 +24,12 @@ namespace NPAPI { base::LazyInstance<PluginList> g_singleton(base::LINKER_INITIALIZED); -static LoadPluginsFromDiskHookFunc g_load_plugins_hook; - // static PluginList* PluginList::Singleton() { return g_singleton.Pointer(); } // static -void PluginList::SetPluginLoadHook(LoadPluginsFromDiskHookFunc hook) { - g_load_plugins_hook = hook; -} - -// static bool PluginList::DebugPluginLoading() { return CommandLine::ForCurrentProcess()->HasSwitch( switches::kDebugPluginLoading); @@ -196,9 +189,6 @@ void PluginList::LoadPlugins(bool refresh) { internal_plugins = internal_plugins_; } - if (g_load_plugins_hook) - g_load_plugins_hook(); - std::vector<WebPluginInfo> new_plugins; std::set<FilePath> visited_plugins; diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 25b903b..101e6b7 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -63,8 +63,6 @@ struct PluginVersionInfo { PluginEntryPoints entry_points; }; -typedef void (*LoadPluginsFromDiskHookFunc)(); - // The PluginList is responsible for loading our NPAPI based plugins. It does // so in whatever manner is appropriate for the platform. On Windows, it loads // plugins from a known directory by looking for DLLs which start with "NP", @@ -78,9 +76,6 @@ class PluginList { // Gets the one instance of the PluginList. static PluginList* Singleton(); - // Set a hook that is called whenever we load plugins from the disk. - static void SetPluginLoadHook(LoadPluginsFromDiskHookFunc hook); - // Returns true if we're in debug-plugin-loading mode. This is controlled // by a command line switch. static bool DebugPluginLoading(); |