Chromium Code Reviews| 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 "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // | 68 // |
| 69 // Child processes typically are caching trace data and only rarely flush | 69 // Child processes typically are caching trace data and only rarely flush |
| 70 // and send trace data back to the browser process. That is because it may be | 70 // and send trace data back to the browser process. That is because it may be |
| 71 // an expensive operation to send the trace data over IPC, and we would like | 71 // an expensive operation to send the trace data over IPC, and we would like |
| 72 // to avoid much runtime overhead of tracing. So, to end tracing, we must | 72 // to avoid much runtime overhead of tracing. So, to end tracing, we must |
| 73 // asynchronously ask all child processes to flush any pending trace data. | 73 // asynchronously ask all child processes to flush any pending trace data. |
| 74 // | 74 // |
| 75 // Once all child processes have acked to the DisableRecording request, | 75 // Once all child processes have acked to the DisableRecording request, |
| 76 // TracingFileResultCallback will be called back with a file that contains | 76 // TracingFileResultCallback will be called back with a file that contains |
| 77 // the traced data. | 77 // the traced data. |
| 78 typedef base::Callback<void(scoped_ptr<base::FilePath>)> | 78 // |
| 79 TracingFileResultCallback; | 79 // Trace data will be written into |result_file_path| if it is not empty, or |
| 80 virtual bool DisableRecording(const TracingFileResultCallback& callback) = 0; | 80 // into a temporary file. The actual file path will be passed to |callback|. |
| 81 // | |
| 82 // If |result_file_path| is empty and |callback| is null, trace data won't be | |
|
dsinclair
2013/11/18 16:32:18
Isn't this an OR instead of an AND.
Xianzhu
2013/11/18 21:50:39
Used 'AND' because I thought the following might b
Xianzhu
2013/11/18 21:56:09
Note this is also consistent with other methods th
| |
| 83 // written to any file. | |
| 84 typedef base::Callback<void(const base::FilePath&)> TracingFileResultCallback; | |
| 85 virtual bool DisableRecording(const base::FilePath& result_file_path, | |
| 86 const TracingFileResultCallback& callback) = 0; | |
| 81 | 87 |
| 82 // Start monitoring on all processes. | 88 // Start monitoring on all processes. |
| 83 // | 89 // |
| 84 // Monitoring begins immediately locally, and asynchronously on child | 90 // Monitoring begins immediately locally, and asynchronously on child |
| 85 // processes as soon as they receive the EnableMonitoring request. | 91 // processes as soon as they receive the EnableMonitoring request. |
| 86 // | 92 // |
| 87 // Once all child processes have acked to the EnableMonitoring request, | 93 // Once all child processes have acked to the EnableMonitoring request, |
| 88 // EnableMonitoringDoneCallback will be called back. | 94 // EnableMonitoringDoneCallback will be called back. |
| 89 // | 95 // |
| 90 // |filter| is a filter to control what category groups should be traced. | 96 // |filter| is a filter to control what category groups should be traced. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 112 // | 118 // |
| 113 // Child processes typically are caching trace data and only rarely flush | 119 // Child processes typically are caching trace data and only rarely flush |
| 114 // and send trace data back to the browser process. That is because it may be | 120 // and send trace data back to the browser process. That is because it may be |
| 115 // an expensive operation to send the trace data over IPC, and we would like | 121 // an expensive operation to send the trace data over IPC, and we would like |
| 116 // to avoid much runtime overhead of tracing. So, to end tracing, we must | 122 // to avoid much runtime overhead of tracing. So, to end tracing, we must |
| 117 // asynchronously ask all child processes to flush any pending trace data. | 123 // asynchronously ask all child processes to flush any pending trace data. |
| 118 // | 124 // |
| 119 // Once all child processes have acked to the CaptureMonitoringSnapshot | 125 // Once all child processes have acked to the CaptureMonitoringSnapshot |
| 120 // request, TracingFileResultCallback will be called back with a file that | 126 // request, TracingFileResultCallback will be called back with a file that |
| 121 // contains the traced data. | 127 // contains the traced data. |
| 128 // | |
| 129 // 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|. | |
| 131 // | |
| 132 // If |result_file_path| is empty and |callback| is null, trace data won't be | |
| 133 // written to any file. | |
| 122 virtual void CaptureMonitoringSnapshot( | 134 virtual void CaptureMonitoringSnapshot( |
| 135 const base::FilePath& result_file_path, | |
| 123 const TracingFileResultCallback& callback) = 0; | 136 const TracingFileResultCallback& callback) = 0; |
| 124 | 137 |
| 125 protected: | 138 protected: |
| 126 virtual ~TracingController() {} | 139 virtual ~TracingController() {} |
| 127 }; | 140 }; |
| 128 | 141 |
| 129 } // namespace content | 142 } // namespace content |
| 130 | 143 |
| 131 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 144 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
| OLD | NEW |