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