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| if |
|
Jói
2013/11/19 12:42:22
into a temporary file -> into the previously set f
| |
| 81 // it's not null. | |
| 82 // | |
| 83 // If |result_file_path| is empty and |callback| is null, trace data won't be | |
|
Jói
2013/11/19 12:42:22
This doesn't look like it's quite accurate for thi
Xianzhu
2013/11/19 16:48:34
result_file_ will be reset to NULL when the whole
| |
| 84 // written to any file. | |
| 85 typedef base::Callback<void(const base::FilePath&)> TracingFileResultCallback; | |
| 86 virtual bool DisableRecording(const base::FilePath& result_file_path, | |
| 87 const TracingFileResultCallback& callback) = 0; | |
| 81 | 88 |
| 82 // Start monitoring on all processes. | 89 // Start monitoring on all processes. |
| 83 // | 90 // |
| 84 // Monitoring begins immediately locally, and asynchronously on child | 91 // Monitoring begins immediately locally, and asynchronously on child |
| 85 // processes as soon as they receive the EnableMonitoring request. | 92 // processes as soon as they receive the EnableMonitoring request. |
| 86 // | 93 // |
| 87 // Once all child processes have acked to the EnableMonitoring request, | 94 // Once all child processes have acked to the EnableMonitoring request, |
| 88 // EnableMonitoringDoneCallback will be called back. | 95 // EnableMonitoringDoneCallback will be called back. |
| 89 // | 96 // |
| 90 // |filter| is a filter to control what category groups should be traced. | 97 // |filter| is a filter to control what category groups should be traced. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 112 // | 119 // |
| 113 // Child processes typically are caching trace data and only rarely flush | 120 // 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 | 121 // 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 | 122 // 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 | 123 // 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. | 124 // asynchronously ask all child processes to flush any pending trace data. |
| 118 // | 125 // |
| 119 // Once all child processes have acked to the CaptureMonitoringSnapshot | 126 // Once all child processes have acked to the CaptureMonitoringSnapshot |
| 120 // request, TracingFileResultCallback will be called back with a file that | 127 // request, TracingFileResultCallback will be called back with a file that |
| 121 // contains the traced data. | 128 // contains the traced data. |
| 129 // | |
| 130 // Trace data will be written into |result_file_path| if it is not empty, or | |
| 131 // into a temporary file. The actual file path will be passed to |callback|. | |
| 132 // | |
| 133 // If |result_file_path| is empty and |callback| is null, trace data won't be | |
| 134 // written to any file. | |
| 122 virtual void CaptureMonitoringSnapshot( | 135 virtual void CaptureMonitoringSnapshot( |
| 136 const base::FilePath& result_file_path, | |
| 123 const TracingFileResultCallback& callback) = 0; | 137 const TracingFileResultCallback& callback) = 0; |
| 124 | 138 |
| 125 protected: | 139 protected: |
| 126 virtual ~TracingController() {} | 140 virtual ~TracingController() {} |
| 127 }; | 141 }; |
| 128 | 142 |
| 129 } // namespace content | 143 } // namespace content |
| 130 | 144 |
| 131 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ | 145 #endif // CONTENT_PUBLIC_BROWSER_TRACING_CONTROLLER_H_ |
| OLD | NEW |