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

Unified Diff: chrome/browser/renderer_host/chrome_extension_message_filter.cc

Issue 889033002: Jump to UI thread for extension activity logging unconditionally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/chrome_extension_message_filter.cc
diff --git a/chrome/browser/renderer_host/chrome_extension_message_filter.cc b/chrome/browser/renderer_host/chrome_extension_message_filter.cc
index 80db105f2eeedccec40d19d9dfce2cf8f4b6ea1f..b519d9bd849de2272e7729da4c18e5b2ecf3cdd0 100644
--- a/chrome/browser/renderer_host/chrome_extension_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_extension_message_filter.cc
@@ -41,24 +41,17 @@ const uint32 kFilteredMessageClasses[] = {
void AddActionToExtensionActivityLog(
Profile* profile,
scoped_refptr<extensions::Action> action) {
- // The ActivityLog can only be accessed from the main (UI) thread. If we're
- // running on the wrong thread, re-dispatch from the main thread.
- if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&AddActionToExtensionActivityLog, profile, action));
- } else {
- if (!g_browser_process->profile_manager()->IsValidProfile(profile))
- return;
- // If the action included a URL, check whether it is for an incognito
- // profile. The check is performed here so that it can safely be done from
- // the UI thread.
- if (action->page_url().is_valid() || !action->page_title().empty())
- action->set_page_incognito(profile->IsOffTheRecord());
- extensions::ActivityLog* activity_log =
- extensions::ActivityLog::GetInstance(profile);
- activity_log->LogAction(action);
- }
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ if (!g_browser_process->profile_manager()->IsValidProfile(profile))
+ return;
+ // If the action included a URL, check whether it is for an incognito
+ // profile. The check is performed here so that it can safely be done from
+ // the UI thread.
+ if (action->page_url().is_valid() || !action->page_title().empty())
+ action->set_page_incognito(profile->IsOffTheRecord());
+ extensions::ActivityLog* activity_log =
+ extensions::ActivityLog::GetInstance(profile);
+ activity_log->LogAction(action);
}
} // namespace
@@ -112,6 +105,9 @@ void ChromeExtensionMessageFilter::OverrideThreadForMessage(
switch (message.type()) {
case ExtensionHostMsg_PostMessage::ID:
case ExtensionHostMsg_CloseChannel::ID:
+ case ExtensionHostMsg_AddAPIActionToActivityLog::ID:
+ case ExtensionHostMsg_AddDOMActionToActivityLog::ID:
+ case ExtensionHostMsg_AddEventToActivityLog::ID:
*thread = BrowserThread::UI;
break;
default:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698