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 CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ | 5 #ifndef CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ |
6 #define CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ | 6 #define CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "components/metrics/proto/profiler_event.pb.h" | 10 #include "components/metrics/proto/profiler_event.pb.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class DictionaryValue; | 13 class DictionaryValue; |
14 class FilePath; | |
15 } | 14 } |
16 | 15 |
17 namespace tracked_objects { | 16 namespace tracked_objects { |
18 struct ProcessDataPhaseSnapshot; | 17 struct ProcessDataPhaseSnapshot; |
19 } | 18 } |
20 | 19 |
21 namespace task_profiler { | 20 namespace task_profiler { |
22 | 21 |
23 // This class collects task profiler data and serializes it to a file. The file | 22 // This class collects task profiler data and serializes it to a file. The file |
24 // format is compatible with the about:profiler UI. | 23 // format is compatible with the about:profiler UI. |
25 class TaskProfilerDataSerializer { | 24 class TaskProfilerDataSerializer { |
26 public: | 25 public: |
27 TaskProfilerDataSerializer() {} | 26 TaskProfilerDataSerializer() {} |
28 | 27 |
29 // Writes the contents of |process_data_phase|, |process_id| and | 28 // Writes the contents of |process_data_phase|, |process_id| and |
30 // |process_type| into |dictionary|. | 29 // |process_type| into |dictionary|. |
31 static void ToValue( | 30 static void ToValue( |
32 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, | 31 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, |
33 base::ProcessId process_id, | 32 base::ProcessId process_id, |
34 metrics::ProfilerEventProto::TrackedObject::ProcessType process_type, | 33 metrics::ProfilerEventProto::TrackedObject::ProcessType process_type, |
35 base::DictionaryValue* dictionary); | 34 base::DictionaryValue* dictionary); |
36 | 35 |
37 private: | 36 private: |
38 DISALLOW_COPY_AND_ASSIGN(TaskProfilerDataSerializer); | 37 DISALLOW_COPY_AND_ASSIGN(TaskProfilerDataSerializer); |
39 }; | 38 }; |
40 | 39 |
41 } // namespace task_profiler | 40 } // namespace task_profiler |
42 | 41 |
43 #endif // CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ | 42 #endif // CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ |
OLD | NEW |