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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/public/common/process_type.h" | |
10 | 9 |
11 namespace base { | 10 namespace base { |
12 class DictionaryValue; | 11 class DictionaryValue; |
13 class FilePath; | 12 class FilePath; |
14 } | 13 } |
15 | 14 |
16 namespace tracked_objects { | 15 namespace tracked_objects { |
17 struct ProcessDataSnapshot; | 16 struct ProcessDataSnapshot; |
18 } | 17 } |
19 | 18 |
20 namespace task_profiler { | 19 namespace task_profiler { |
21 | 20 |
22 // This class collects task profiler data and serializes it to a file. The file | 21 // This class collects task profiler data and serializes it to a file. The file |
23 // format is compatible with the about:profiler UI. | 22 // format is compatible with the about:profiler UI. |
24 class TaskProfilerDataSerializer { | 23 class TaskProfilerDataSerializer { |
25 public: | 24 public: |
26 TaskProfilerDataSerializer() {} | 25 TaskProfilerDataSerializer() {} |
27 | 26 |
28 // Writes the contents of |process_data| and |process_type| into |dictionary|. | 27 // Writes the contents of |process_data| and |process_type| into |dictionary|. |
29 static void ToValue(const tracked_objects::ProcessDataSnapshot& process_data, | 28 static void ToValue(const tracked_objects::ProcessDataSnapshot& process_data, |
30 content::ProcessType process_type, | 29 int process_type, |
31 base::DictionaryValue* dictionary); | 30 base::DictionaryValue* dictionary); |
32 | 31 |
33 bool WriteToFile(const base::FilePath& path); | 32 bool WriteToFile(const base::FilePath& path); |
34 | 33 |
35 private: | 34 private: |
36 DISALLOW_COPY_AND_ASSIGN(TaskProfilerDataSerializer); | 35 DISALLOW_COPY_AND_ASSIGN(TaskProfilerDataSerializer); |
37 }; | 36 }; |
38 | 37 |
39 } // namespace task_profiler | 38 } // namespace task_profiler |
40 | 39 |
41 #endif // CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ | 40 #endif // CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ |
OLD | NEW |