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

Unified Diff: extensions/browser/event_router.cc

Issue 2077723002: [Extensions] Short-circuit activity logging if not enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Test Created 4 years, 6 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 | « extensions/browser/api_activity_monitor.cc ('k') | extensions/browser/extension_function_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/event_router.cc
diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc
index a2a6505e28515d413c3fcac9ad7d7100d4d1f9dd..d10d4f87aa8783695f9fe7f41a2a6a1af6ac6529 100644
--- a/extensions/browser/event_router.cc
+++ b/extensions/browser/event_router.cc
@@ -63,24 +63,11 @@ const char kFilteredEvents[] = "filtered_events";
void NotifyEventDispatched(void* browser_context_id,
const std::string& extension_id,
const std::string& event_name,
- std::unique_ptr<ListValue> args) {
- // The ApiActivityMonitor can only be accessed from the UI thread.
- if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&NotifyEventDispatched, browser_context_id, extension_id,
- event_name, base::Passed(&args)));
- return;
- }
-
+ const base::ListValue& args) {
// Notify the ApiActivityMonitor about the event dispatch.
BrowserContext* context = static_cast<BrowserContext*>(browser_context_id);
- if (!ExtensionsBrowserClient::Get()->IsValidContext(context))
- return;
- ApiActivityMonitor* monitor =
- ExtensionsBrowserClient::Get()->GetApiActivityMonitor(context);
- if (monitor)
- monitor->OnApiEventDispatched(extension_id, event_name, std::move(args));
+ activity_monitor::OnApiEventDispatched(context, extension_id, event_name,
+ args);
}
// A global identifier used to distinguish extension events.
@@ -114,7 +101,7 @@ void EventRouter::DispatchExtensionMessage(IPC::Sender* ipc_sender,
UserGestureState user_gesture,
const EventFilteringInfo& info) {
NotifyEventDispatched(browser_context_id, extension_id, event_name,
- base::WrapUnique(event_args->DeepCopy()));
+ *event_args);
// TODO(chirantan): Make event dispatch a separate IPC so that it doesn't
// piggyback off MessageInvoke, which is used for other things.
« no previous file with comments | « extensions/browser/api_activity_monitor.cc ('k') | extensions/browser/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698