diff --git a/base/profiler/scoped_profile.h b/base/profiler/scoped_profile.h index c435a1dea1cd4..7290908c5ce9e 100644 --- a/base/profiler/scoped_profile.h +++ b/base/profiler/scoped_profile.h @@ -17,31 +17,16 @@ #include "base/profiler/tracked_time.h" #include "base/tracked_objects.h" -#if defined(GOOGLE_CHROME_BUILD) - -// We don't ship these profiled regions. This is for developer builds only. -// It allows developers to do some profiling of their code, and see results on -// their about:profiler page. -#define TRACK_RUN_IN_THIS_SCOPED_REGION_FOR_DEVELOPER_BUILDS(scope_name) \ - ((void)0) - -#else - -#define TRACK_RUN_IN_THIS_SCOPED_REGION_FOR_DEVELOPER_BUILDS(scope_name) \ - ::tracked_objects::ScopedProfile LINE_BASED_VARIABLE_NAME_FOR_PROFILING( \ - FROM_HERE_WITH_EXPLICIT_FUNCTION(#scope_name)) - -#endif - - - #define PASTE_LINE_NUMBER_ON_NAME(name, line) name##line #define LINE_BASED_VARIABLE_NAME_FOR_PROFILING \ PASTE_LINE_NUMBER_ON_NAME(some_profiler_variable_, __LINE__) -#define TRACK_RUN_IN_IPC_HANDLER(dispatch_function_name) \ - ::tracked_objects::ScopedProfile some_tracking_variable_name( \ +// Defines the containing scope as a profiled region. This allows developers to +// profile their code and see results on their about:profiler page, as well as +// on the UMA dashboard. +#define TRACK_RUN_IN_THIS_SCOPED_REGION(dispatch_function_name) \ + ::tracked_objects::ScopedProfile LINE_BASED_VARIABLE_NAME_FOR_PROFILING( \ FROM_HERE_WITH_EXPLICIT_FUNCTION(#dispatch_function_name)) diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc index d006d1e9a7588..d3fcc2d350da2 100644 --- a/extensions/browser/event_router.cc +++ b/extensions/browser/event_router.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/message_loop/message_loop.h" +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "base/values.h" #include "content/public/browser/child_process_security_policy.h" @@ -237,8 +238,13 @@ void EventRouter::OnListenerAdded(const EventListener* listener) { listener->GetBrowserContext()); std::string base_event_name = GetBaseEventName(listener->event_name()); ObserverMap::iterator observer = observers_.find(base_event_name); - if (observer != observers_.end()) + if (observer != observers_.end()) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "EventRouter_OnListenerAdded_ObserverCall")); observer->second->OnListenerAdded(details); + } } void EventRouter::OnListenerRemoved(const EventListener* listener) { diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 4644113e3996e..e38ef28e3fa01 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -914,7 +914,7 @@ #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ case msg_class::ID: { \ - TRACK_RUN_IN_IPC_HANDLER(member_func); \ + TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \ &member_func)) \ ipc_message__.set_dispatch_error(); \ @@ -926,7 +926,7 @@ #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ case msg_class::ID: { \ - TRACK_RUN_IN_IPC_HANDLER(member_func); \ + TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ if (!msg_class::DispatchDelayReply(&ipc_message__, obj, param__, \ &member_func)) \ ipc_message__.set_dispatch_error(); \ @@ -940,14 +940,14 @@ // TODO(jar): fix chrome frame to always supply |code| argument. #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ case msg_class::ID: { \ - /* TRACK_RUN_IN_IPC_HANDLER(code); TODO(jar) */ \ + /* TRACK_RUN_IN_THIS_SCOPED_REGION(code); TODO(jar) */ \ code; \ } \ break; #define IPC_REPLY_HANDLER(func) \ case IPC_REPLY_ID: { \ - TRACK_RUN_IN_IPC_HANDLER(func); \ + TRACK_RUN_IN_THIS_SCOPED_REGION(func); \ func(ipc_message__); \ } \ break; diff --git a/ppapi/host/dispatch_host_message.h b/ppapi/host/dispatch_host_message.h index 24987259ebc46..218b8f7b8776f 100644 --- a/ppapi/host/dispatch_host_message.h +++ b/ppapi/host/dispatch_host_message.h @@ -10,7 +10,7 @@ #ifndef PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_ #define PPAPI_HOST_DISPATCH_HOST_MESSAGE_H_ -#include "base/profiler/scoped_profile.h" // For TRACK_RUN_IN_IPC_HANDLER. +#include "base/profiler/scoped_profile.h" #include "ipc/ipc_message_macros.h" #include "ppapi/c/pp_errors.h" @@ -66,7 +66,7 @@ inline int32_t DispatchResourceCall(ObjT* obj, Method method, // no params in the message). #define PPAPI_DISPATCH_HOST_RESOURCE_CALL(msg_class, member_func) \ case msg_class::ID: { \ - TRACK_RUN_IN_IPC_HANDLER(member_func); \ + TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ msg_class::Schema::Param p; \ if (msg_class::Read(&ipc_message__, &p)) { \ return ppapi::host::DispatchResourceCall( \ @@ -79,7 +79,7 @@ inline int32_t DispatchResourceCall(ObjT* obj, Method method, #define PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(msg_class, member_func) \ case msg_class::ID: { \ - TRACK_RUN_IN_IPC_HANDLER(member_func); \ + TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ return member_func(context); \ } diff --git a/ppapi/proxy/dispatch_reply_message.h b/ppapi/proxy/dispatch_reply_message.h index ce4c6020ef447..56a450891b710 100644 --- a/ppapi/proxy/dispatch_reply_message.h +++ b/ppapi/proxy/dispatch_reply_message.h @@ -11,7 +11,6 @@ #define PPAPI_PROXY_DISPATCH_REPLY_MESSAGE_H_ #include "base/callback.h" -#include "base/profiler/scoped_profile.h" // For TRACK_RUN_IN_IPC_HANDLER. #include "ipc/ipc_message_macros.h" #include "ppapi/c/pp_errors.h"