summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_dom_ui.cc
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 20:19:57 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 20:19:57 +0000
commit790879f7d6faea44ef0d13c2f7b44fe74edafa5e (patch)
tree6d0210a7594a265ba97425289f0a0ac44aabfb62 /chrome/browser/extensions/extension_dom_ui.cc
parent36ea6c6f047abed672aa9af4f3071a7364142d64 (diff)
downloadchromium_src-790879f7d6faea44ef0d13c2f7b44fe74edafa5e.zip
chromium_src-790879f7d6faea44ef0d13c2f7b44fe74edafa5e.tar.gz
chromium_src-790879f7d6faea44ef0d13c2f7b44fe74edafa5e.tar.bz2
Change so that the extension favicon is read on the UI thread since extension objects should only be accessed on the UI thread.
This also fixes erg's todo to make favicons use RefCountedMemory instead of RefCountedBytes in all places. BUG=None TEST=None Review URL: http://codereview.chromium.org/1028001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_dom_ui.cc')
-rw-r--r--chrome/browser/extensions/extension_dom_ui.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
index 424dd80e..e9866b1 100644
--- a/chrome/browser/extensions/extension_dom_ui.cc
+++ b/chrome/browser/extensions/extension_dom_ui.cc
@@ -27,8 +27,9 @@ const wchar_t kExtensionURLOverrides[] = L"extensions.chrome_url_overrides";
// Returns a piece of memory with the contents of the file |path|.
RefCountedMemory* ReadFileData(const FilePath& path) {
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
-
+ // TODO(arv): We currently read this on the UI thread since extension objects
+ // can only safely be accessed on the UI thread. Read the file on the FILE
+ // thread and cache the result on the UI thread instead.
if (path.empty())
return NULL;
@@ -71,7 +72,7 @@ void ExtensionDOMUI::ResetExtensionFunctionDispatcher(
void ExtensionDOMUI::ResetExtensionBookmarkManagerEventRouter() {
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedBookmarkManager)) {
+ switches::kEnableTabbedBookmarkManager)) {
extension_bookmark_manager_event_router_.reset(
new ExtensionBookmarkManagerEventRouter(GetProfile(), tab_contents()));
}
@@ -317,6 +318,9 @@ void ExtensionDOMUI::UnregisterChromeURLOverrides(
// static
RefCountedMemory* ExtensionDOMUI::GetFaviconResourceBytes(Profile* profile,
GURL page_url) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)) << "The extension "
+ "objects should only be accessed on the UI thread.";
+
// Even when the extensions service is enabled by default, it's still
// disabled in incognito mode.
ExtensionsService* service = profile->GetExtensionsService();