Commit c7ac8c2c authored by reillyg's avatar reillyg Committed by Commit bot

Jump to UI thread for extension activity logging unconditionally.

Always dispatch the extension activity logging IPCs to the UI thread
instead of checking first as the check will always be true.

Review URL: https://codereview.chromium.org/889033002

Cr-Commit-Position: refs/heads/master@{#314172}
parent 2c042d92
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment