| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <set> |
| 9 |
| 8 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 9 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 10 | 12 |
| 11 namespace base { | 13 namespace base { |
| 12 class FilePath; | 14 class FilePath; |
| 13 }; | 15 }; |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 | 18 |
| 17 class TracingController; | 19 class TracingController; |
| 18 | 20 |
| 19 // TracingController is used on the browser processes to enable/disable | 21 // TracingController is used on the browser processes to enable/disable |
| 20 // trace status and collect trace data. Only the browser UI thread is allowed | 22 // trace status and collect trace data. Only the browser UI thread is allowed |
| 21 // to interact with the TracingController object. All callbacks are called on | 23 // to interact with the TracingController object. All callbacks are called on |
| 22 // the UI thread. | 24 // the UI thread. |
| 23 class TracingController { | 25 class TracingController { |
| 24 public: | 26 public: |
| 25 enum Options { | 27 enum Options { |
| 26 ENABLE_SYSTRACE = 1 << 0, | 28 ENABLE_SYSTRACE = 1 << 0, |
| 27 ENABLE_SAMPLING = 1 << 1, | 29 ENABLE_SAMPLING = 1 << 1, |
| 30 RECORD_CONTINUOUSLY = 1 << 2, // For EnableRecording() only. |
| 28 }; | 31 }; |
| 29 | 32 |
| 30 CONTENT_EXPORT static TracingController* GetInstance(); | 33 CONTENT_EXPORT static TracingController* GetInstance(); |
| 31 | 34 |
| 32 // Get a set of category groups. The category groups can change as | 35 // Get a set of category groups. The category groups can change as |
| 33 // new code paths are reached. | 36 // new code paths are reached. |
| 34 // | 37 // |
| 35 // Once all child processes have acked to the GetCategories request, | 38 // Once all child processes have acked to the GetCategories request, |
| 36 // GetCategoriesDoneCallback is called back with a set of category | 39 // GetCategoriesDoneCallback is called back with a set of category |
| 37 // groups. | 40 // groups. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // | 131 // |
| 129 // Trace data will be written into |result_file_path| if it is not empty, or | 132 // Trace data will be written into |result_file_path| if it is not empty, or |
| 130 // into a temporary file. The actual file path will be passed to |callback|. | 133 // into a temporary file. The actual file path will be passed to |callback|. |
| 131 // | 134 // |
| 132 // If |result_file_path| is empty and |callback| is null, trace data won't be | 135 // If |result_file_path| is empty and |callback| is null, trace data won't be |
| 133 // written to any file. | 136 // written to any file. |
| 134 virtual void CaptureMonitoringSnapshot( | 137 virtual void CaptureMonitoringSnapshot( |
| 135 const base::FilePath& result_file_path, | 138 const base::FilePath& result_file_path, |
| 136 const TracingFileResultCallback& callback) = 0; | 139 const TracingFileResultCallback& callback) = 0; |
| 137 | 140 |
| 141 // Get the maximum across processes of trace buffer percent full state. |
| 142 // When the TraceBufferPercentFull value is determined, the callback is |
| 143 // called. |
| 144 typedef base::Callback<void(float)> GetTraceBufferPercentFullCallback; |
| 145 virtual bool GetTraceBufferPercentFull( |
| 146 const GetTraceBufferPercentFullCallback& callback) = 0; |
| 147 |
| 138 protected: | 148 protected: |
| 139 virtual ~TracingController() {} | 149 virtual ~TracingController() {} |
| 140 }; | 150 }; |
| 141 | 151 |
| 142 } // namespace content | 152 } // namespace content |
| 143 | 153 |
| 144 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 154 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
| OLD | NEW |