Index: base/profiler/scoped_tracker.h |
diff --git a/base/profiler/scoped_tracker.h b/base/profiler/scoped_tracker.h |
index f83654e1bd48e55fa7ddd3f88837871dd4eff2c7..23e2f07b61f750897b366dad780f837e2d7cbfdd 100644 |
--- a/base/profiler/scoped_tracker.h |
+++ b/base/profiler/scoped_tracker.h |
@@ -10,6 +10,7 @@ |
// found using profiler data. |
#include "base/base_export.h" |
+#include "base/bind.h" |
#include "base/callback_forward.h" |
#include "base/location.h" |
#include "base/profiler/scoped_profile.h" |
@@ -47,10 +48,24 @@ class BASE_EXPORT ScopedTracker { |
// many possible callbacks, but they come from a relatively small number of |
// places. We can instrument these few places and at least know which one |
// passes the janky callback. |
- static base::Closure TrackCallback(const Location& location, |
- const base::Closure& callback); |
+ template <typename P1> |
+ static base::Callback<void(P1)> TrackCallback( |
+ const Location& location, |
+ const base::Callback<void(P1)>& callback) { |
+ return base::Bind(&ScopedTracker::ExecuteAndTrackCallback<P1>, location, |
+ callback); |
+ } |
private: |
+ // Executes |callback|, augmenting it with provided |location|. |
+ template <typename P1> |
+ static void ExecuteAndTrackCallback(const Location& location, |
+ const base::Callback<void(P1)>& callback, |
+ P1 p1) { |
+ ScopedTracker tracking_profile(location); |
+ callback.Run(p1); |
+ } |
+ |
const ScopedProfile scoped_profile_; |
DISALLOW_COPY_AND_ASSIGN(ScopedTracker); |