| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 class TracingHandler { | 34 class TracingHandler { |
| 35 public: | 35 public: |
| 36 typedef DevToolsProtocolClient::Response Response; | 36 typedef DevToolsProtocolClient::Response Response; |
| 37 | 37 |
| 38 enum Target { Browser, Renderer }; | 38 enum Target { Browser, Renderer }; |
| 39 TracingHandler(Target target, | 39 TracingHandler(Target target, |
| 40 int frame_tree_node_id, | 40 int frame_tree_node_id, |
| 41 DevToolsIOContext* io_context); | 41 DevToolsIOContext* io_context); |
| 42 virtual ~TracingHandler(); | 42 virtual ~TracingHandler(); |
| 43 | 43 |
| 44 void SetClient(scoped_ptr<Client> client); | 44 void SetClient(std::unique_ptr<Client> client); |
| 45 void Detached(); | 45 void Detached(); |
| 46 | 46 |
| 47 void OnTraceDataCollected(const std::string& trace_fragment); | 47 void OnTraceDataCollected(const std::string& trace_fragment); |
| 48 void OnTraceComplete(); | 48 void OnTraceComplete(); |
| 49 void OnTraceToStreamComplete(const std::string& stream_handle); | 49 void OnTraceToStreamComplete(const std::string& stream_handle); |
| 50 | 50 |
| 51 // Protocol methods. | 51 // Protocol methods. |
| 52 Response Start(DevToolsCommandId command_id, | 52 Response Start(DevToolsCommandId command_id, |
| 53 const std::string* categories, | 53 const std::string* categories, |
| 54 const std::string* options, | 54 const std::string* options, |
| 55 const double* buffer_usage_reporting_interval, | 55 const double* buffer_usage_reporting_interval, |
| 56 const std::string* transfer_mode, | 56 const std::string* transfer_mode, |
| 57 const scoped_ptr<base::DictionaryValue>& config); | 57 const std::unique_ptr<base::DictionaryValue>& config); |
| 58 Response End(DevToolsCommandId command_id); | 58 Response End(DevToolsCommandId command_id); |
| 59 Response GetCategories(DevToolsCommandId command); | 59 Response GetCategories(DevToolsCommandId command); |
| 60 Response RequestMemoryDump(DevToolsCommandId command_id); | 60 Response RequestMemoryDump(DevToolsCommandId command_id); |
| 61 Response RecordClockSyncMarker(const std::string& sync_id); | 61 Response RecordClockSyncMarker(const std::string& sync_id); |
| 62 | 62 |
| 63 bool did_initiate_recording() { return did_initiate_recording_; } | 63 bool did_initiate_recording() { return did_initiate_recording_; } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 void OnRecordingEnabled(DevToolsCommandId command_id); | 66 void OnRecordingEnabled(DevToolsCommandId command_id); |
| 67 void OnBufferUsage(float percent_full, size_t approximate_event_count); | 67 void OnBufferUsage(float percent_full, size_t approximate_event_count); |
| 68 void OnCategoriesReceived(DevToolsCommandId command_id, | 68 void OnCategoriesReceived(DevToolsCommandId command_id, |
| 69 const std::set<std::string>& category_set); | 69 const std::set<std::string>& category_set); |
| 70 void OnMemoryDumpFinished(DevToolsCommandId command_id, | 70 void OnMemoryDumpFinished(DevToolsCommandId command_id, |
| 71 uint64_t dump_guid, | 71 uint64_t dump_guid, |
| 72 bool success); | 72 bool success); |
| 73 | 73 |
| 74 void SetupTimer(double usage_reporting_interval); | 74 void SetupTimer(double usage_reporting_interval); |
| 75 void StopTracing( | 75 void StopTracing( |
| 76 const scoped_refptr<TracingController::TraceDataSink>& trace_data_sink); | 76 const scoped_refptr<TracingController::TraceDataSink>& trace_data_sink); |
| 77 bool IsTracing() const; | 77 bool IsTracing() const; |
| 78 static bool IsStartupTracingActive(); | 78 static bool IsStartupTracingActive(); |
| 79 CONTENT_EXPORT static base::trace_event::TraceConfig | 79 CONTENT_EXPORT static base::trace_event::TraceConfig |
| 80 GetTraceConfigFromDevToolsConfig( | 80 GetTraceConfigFromDevToolsConfig( |
| 81 const base::DictionaryValue& devtools_config); | 81 const base::DictionaryValue& devtools_config); |
| 82 | 82 |
| 83 scoped_ptr<base::Timer> buffer_usage_poll_timer_; | 83 std::unique_ptr<base::Timer> buffer_usage_poll_timer_; |
| 84 Target target_; | 84 Target target_; |
| 85 | 85 |
| 86 scoped_ptr<Client> client_; | 86 std::unique_ptr<Client> client_; |
| 87 DevToolsIOContext* io_context_; | 87 DevToolsIOContext* io_context_; |
| 88 int frame_tree_node_id_; | 88 int frame_tree_node_id_; |
| 89 bool did_initiate_recording_; | 89 bool did_initiate_recording_; |
| 90 bool return_as_stream_; | 90 bool return_as_stream_; |
| 91 base::WeakPtrFactory<TracingHandler> weak_factory_; | 91 base::WeakPtrFactory<TracingHandler> weak_factory_; |
| 92 | 92 |
| 93 FRIEND_TEST_ALL_PREFIXES(TracingHandlerTest, | 93 FRIEND_TEST_ALL_PREFIXES(TracingHandlerTest, |
| 94 GetTraceConfigFromDevToolsConfig); | 94 GetTraceConfigFromDevToolsConfig); |
| 95 DISALLOW_COPY_AND_ASSIGN(TracingHandler); | 95 DISALLOW_COPY_AND_ASSIGN(TracingHandler); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace tracing | 98 } // namespace tracing |
| 99 } // namespace devtools | 99 } // namespace devtools |
| 100 } // namespace content | 100 } // namespace content |
| 101 | 101 |
| 102 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ | 102 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ |
| OLD | NEW |