Chromium Code Reviews| Index: components/metrics/profiler/tracking_synchronizer.h |
| diff --git a/components/metrics/profiler/tracking_synchronizer.h b/components/metrics/profiler/tracking_synchronizer.h |
| index 590f3c32ad084e3bc9a78a57b6db0984d3ac406c..9bfba101a36d87b63daf2186ad5087271dcac7b1 100644 |
| --- a/components/metrics/profiler/tracking_synchronizer.h |
| +++ b/components/metrics/profiler/tracking_synchronizer.h |
| @@ -54,6 +54,11 @@ class TrackingSynchronizer |
| static void FetchProfilerDataAsynchronously( |
| const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); |
| + // Called when a profiling phase completes. |profiling_event| is the event |
| + // associated with completing the phase and starting a new one. |
|
Ilya Sherman
2015/04/07 01:15:30
nit: Suggested rewording: "|profiling_event| is th
vadimt
2015/04/07 21:44:14
Done.
|
| + static void OnProfilingPhaseCompletion( |
| + ProfilerEventProto::ProfilerEvent profiling_event); |
| + |
| // ------------------------------------------------------ |
| // ProfilerSubscriber methods for browser child processes |
| // ------------------------------------------------------ |
| @@ -64,15 +69,28 @@ class TrackingSynchronizer |
| int pending_processes, |
| bool end) override; |
| + protected: |
| + ~TrackingSynchronizer() override; |
| + |
| + // Update the sequence of completed phases with a new phase completion info. |
| + // |now| is the current time, but can be something else in tests. |
| + void RegisterPhaseCompletion( |
| + ProfilerEventProto::ProfilerEvent profiling_event, |
| + base::TimeTicks now); |
| + |
| + // Notify |observer| about |profiler_data| received from process of type |
| + // |process_type|. |now| is the current time, but can be something else in |
| + // tests. |
| + void SendData(const tracked_objects::ProcessDataSnapshot& profiler_data, |
| + content::ProcessType process_type, |
| + base::TimeTicks now, |
| + TrackingSynchronizerObserver* observer) const; |
| + |
| private: |
| friend class base::RefCountedThreadSafe<TrackingSynchronizer>; |
| - // TODO(vadimt): Remove friending TrackingSynchronizerTest_ProfilerData_Test. |
| - friend class TrackingSynchronizerTest_ProfilerData_Test; |
| class RequestContext; |
| - ~TrackingSynchronizer() override; |
| - |
| // Send profiler_data back to callback_object_ by calling |
| // DecrementPendingProcessesAndSendData which records that we are waiting |
| // for one less profiler data from renderer or browser child process for the |
| @@ -89,13 +107,10 @@ class TrackingSynchronizer |
| int RegisterAndNotifyAllProcesses( |
| const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); |
| - // Notify |observer| about |profiler_data| received from process of type |
| - // |process_type|. |now| is the current time, but can be something else in |
| - // tests. |
| - void SendData(const tracked_objects::ProcessDataSnapshot& profiler_data, |
| - content::ProcessType process_type, |
| - base::TimeTicks now, |
| - TrackingSynchronizerObserver* observer) const; |
| + // Notifies all processes of a completion of a profiling phase. |
| + // |profiling_event| is the event associated with the phase change. |
| + void NotifyAllProcessesOfProfilingPhaseCompletion( |
| + ProfilerEventProto::ProfilerEvent profiling_event); |
| // It finds the RequestContext for the given |sequence_number| and notifies |
| // the RequestContext's |callback_object_| about the |value|. This is called |
| @@ -127,7 +142,6 @@ class TrackingSynchronizer |
| std::vector<ProfilerEventProto::ProfilerEvent> |
| phase_completion_events_sequence_; |
| - // TODO(vadimt): consider moving 2 fields below to metrics service. |
| // Time of the profiling start. Used to calculate times of phase change |
| // moments relative to this value. |
| const base::TimeTicks start_time_; |