| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ | 5 #ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ |
| 6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ | 6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 11 |
| 12 namespace base { |
| 13 class TimeDelta; |
| 14 } |
| 15 |
| 8 namespace tracked_objects { | 16 namespace tracked_objects { |
| 9 struct ProcessDataSnapshot; | 17 struct ProcessDataPhaseSnapshot; |
| 10 } | 18 } |
| 11 | 19 |
| 12 namespace metrics { | 20 namespace metrics { |
| 13 | 21 |
| 22 // Set of profiling events, in no guaranteed order. |
| 23 typedef std::vector<ProfilerEventProto::ProfilerEvent> ProfilerEventsSet; |
| 24 |
| 14 // Observer for notifications from the TrackingSynchronizer class. | 25 // Observer for notifications from the TrackingSynchronizer class. |
| 15 class TrackingSynchronizerObserver { | 26 class TrackingSynchronizerObserver { |
| 16 public: | 27 public: |
| 17 // Received |profiler_data| from a single process of |process_type|. | 28 // Received |process_data_phase| for profiling phase |profiling_phase| from a |
| 29 // single process of |process_type|. The phase start and finish times, |
| 30 // relative to the start time are |profiling_phase_start| and |
| 31 // |profiling_phase_finish|. |past_profiler_events| is the set of events that |
| 32 // caused finishing prior profiling phases. |
| 18 // The observer should assume there might be more data coming until | 33 // The observer should assume there might be more data coming until |
| 19 // |FinishedReceivingData()| is called. | 34 // |FinishedReceivingData()| is called. |
| 20 virtual void ReceivedProfilerData( | 35 virtual void ReceivedProfilerData( |
| 21 const tracked_objects::ProcessDataSnapshot& profiler_data, | 36 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, |
| 22 int process_type) = 0; | 37 int process_id, |
| 38 int process_type, |
| 39 int profiling_phase, |
| 40 const base::TimeDelta& profiling_phase_start, |
| 41 const base::TimeDelta& profiling_phase_finish, |
| 42 const ProfilerEventsSet& past_profiler_events) = 0; |
| 23 | 43 |
| 24 // The observer should not expect any more calls to |ReceivedProfilerData()| | 44 // The observer should not expect any more calls to |ReceivedProfilerData()| |
| 25 // (without re-registering). This is sent either when data from all processes | 45 // (without re-registering). This is sent either when data from all processes |
| 26 // has been gathered, or when the request times out. | 46 // has been gathered, or when the request times out. |
| 27 virtual void FinishedReceivingProfilerData() {} | 47 virtual void FinishedReceivingProfilerData() {} |
| 28 | 48 |
| 29 protected: | 49 protected: |
| 30 TrackingSynchronizerObserver() {} | 50 TrackingSynchronizerObserver() {} |
| 31 virtual ~TrackingSynchronizerObserver() {} | 51 virtual ~TrackingSynchronizerObserver() {} |
| 32 | 52 |
| 33 private: | 53 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver); | 54 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver); |
| 35 }; | 55 }; |
| 36 | 56 |
| 37 } // namespace metrics | 57 } // namespace metrics |
| 38 | 58 |
| 39 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ | 59 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_ |
| OLD | NEW |