| Index: content/browser/tracing/tracing_controller_impl.h
|
| diff --git a/content/browser/tracing/tracing_controller_impl.h b/content/browser/tracing/tracing_controller_impl.h
|
| index 553592e0527791bb860b2f7270c2196764bb2d85..999dac79e7461b53e0109c1053a3dd4f8ba6011b 100644
|
| --- a/content/browser/tracing/tracing_controller_impl.h
|
| +++ b/content/browser/tracing/tracing_controller_impl.h
|
| @@ -11,9 +11,13 @@
|
|
|
| #include "base/files/file_path.h"
|
| #include "base/lazy_instance.h"
|
| -#include "content/public/browser/trace_subscriber.h"
|
| #include "content/public/browser/tracing_controller.h"
|
|
|
| +namespace base {
|
| +class RefCountedString;
|
| +class DictionaryValue;
|
| +}
|
| +
|
| namespace content {
|
|
|
| class TraceMessageFilter;
|
| @@ -26,29 +30,47 @@ class TracingControllerImpl : public TracingController {
|
| virtual void GetCategories(
|
| const GetCategoriesDoneCallback& callback) OVERRIDE;
|
| virtual bool EnableRecording(
|
| - const base::debug::CategoryFilter& filter,
|
| + const std::string& category_filter,
|
| TracingController::Options options,
|
| const EnableRecordingDoneCallback& callback) OVERRIDE;
|
| virtual bool DisableRecording(
|
| const base::FilePath& result_file_path,
|
| const TracingFileResultCallback& callback) OVERRIDE;
|
| - virtual bool EnableMonitoring(const base::debug::CategoryFilter& filter,
|
| + virtual bool EnableMonitoring(const std::string& category_filter,
|
| TracingController::Options options,
|
| const EnableMonitoringDoneCallback& callback) OVERRIDE;
|
| virtual bool DisableMonitoring(
|
| const DisableMonitoringDoneCallback& callback) OVERRIDE;
|
| virtual void GetMonitoringStatus(
|
| bool* out_enabled,
|
| - base::debug::CategoryFilter* out_filter,
|
| + std::string* out_category_filter,
|
| TracingController::Options* out_options) OVERRIDE;
|
| virtual void CaptureMonitoringSnapshot(
|
| const base::FilePath& result_file_path,
|
| const TracingFileResultCallback& callback) OVERRIDE;
|
| virtual bool GetTraceBufferPercentFull(
|
| const GetTraceBufferPercentFullCallback& callback) OVERRIDE;
|
| + virtual bool SetWatchEvent(const std::string& category_name,
|
| + const std::string& event_name,
|
| + const WatchEventCallback& callback) OVERRIDE;
|
| + virtual bool CancelWatchEvent() OVERRIDE;
|
| +
|
| + // Parse tracing filter and options from a DictionaryValue which is in the
|
| + // following format:
|
| + // { "categoryFilter": <category_filter_string>,
|
| + // "useSystemTracing": <bool>,
|
| + // "useContinuousTracing": <bool>,
|
| + // "useSampling": <bool> }
|
| + static bool ParseTracingParams(const base::DictionaryValue* params,
|
| + std::string* category_filter,
|
| + Options* options);
|
| + // Encode tracing filter and options into a JSON string.
|
| + static void EncodeTracingParams(const std::string& category_filter,
|
| + Options options,
|
| + base::DictionaryValue* result);
|
|
|
| private:
|
| - typedef std::set<scoped_refptr<TraceMessageFilter> > FilterMap;
|
| + typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterMap;
|
| class ResultFile;
|
|
|
| friend struct base::DefaultLazyInstanceTraits<TracingControllerImpl>;
|
| @@ -78,9 +100,17 @@ class TracingControllerImpl : public TracingController {
|
| return pending_trace_buffer_percent_full_callback_.is_null();
|
| }
|
|
|
| + bool can_set_watch_event() const {
|
| + return watch_event_callback_.is_null();
|
| + }
|
| +
|
| + bool can_cancel_watch_event() const {
|
| + return !watch_event_callback_.is_null();
|
| + }
|
| +
|
| // Methods for use by TraceMessageFilter.
|
| - void AddFilter(TraceMessageFilter* filter);
|
| - void RemoveFilter(TraceMessageFilter* filter);
|
| + void AddTraceMessageFilter(TraceMessageFilter* trace_message_filter);
|
| + void RemoveTraceMessageFilter(TraceMessageFilter* trace_message_filter);
|
|
|
| void OnTraceDataCollected(
|
| const scoped_refptr<base::RefCountedString>& events_str_ptr);
|
| @@ -103,10 +133,11 @@ class TracingControllerImpl : public TracingController {
|
| void OnCaptureMonitoringSnapshotAcked();
|
| void OnMonitoringSnapshotFileClosed();
|
|
|
| - void OnTraceNotification(int notification);
|
| void OnTraceBufferPercentFullReply(float percent_full);
|
|
|
| - FilterMap filters_;
|
| + void OnWatchEventMatched();
|
| +
|
| + TraceMessageFilterMap trace_message_filters_;
|
| // Pending acks for DisableRecording.
|
| int pending_disable_recording_ack_count_;
|
| // Pending acks for CaptureMonitoringSnapshot.
|
| @@ -122,9 +153,9 @@ class TracingControllerImpl : public TracingController {
|
| TracingFileResultCallback pending_disable_recording_done_callback_;
|
| TracingFileResultCallback pending_capture_monitoring_snapshot_done_callback_;
|
| GetTraceBufferPercentFullCallback pending_trace_buffer_percent_full_callback_;
|
| + WatchEventCallback watch_event_callback_;
|
|
|
| std::set<std::string> known_category_groups_;
|
| - base::debug::CategoryFilter category_filter_;
|
| scoped_ptr<ResultFile> result_file_;
|
| scoped_ptr<ResultFile> monitoring_snapshot_file_;
|
| DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl);
|
|
|