| 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 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 17 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" | 18 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
| 18 #include "content/public/browser/tracing_controller.h" | 19 #include "content/public/browser/tracing_controller.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class RefCountedString; | 22 class RefCountedString; |
| 22 class Timer; | 23 class Timer; |
| 23 } | 24 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 void OnTraceDataCollected(const std::string& trace_fragment); | 46 void OnTraceDataCollected(const std::string& trace_fragment); |
| 46 void OnTraceComplete(); | 47 void OnTraceComplete(); |
| 47 void OnTraceToStreamComplete(const std::string& stream_handle); | 48 void OnTraceToStreamComplete(const std::string& stream_handle); |
| 48 | 49 |
| 49 // Protocol methods. | 50 // Protocol methods. |
| 50 Response Start(DevToolsCommandId command_id, | 51 Response Start(DevToolsCommandId command_id, |
| 51 const std::string* categories, | 52 const std::string* categories, |
| 52 const std::string* options, | 53 const std::string* options, |
| 53 const double* buffer_usage_reporting_interval, | 54 const double* buffer_usage_reporting_interval, |
| 54 const std::string* transfer_mode); | 55 const std::string* transfer_mode, |
| 56 const scoped_ptr<base::DictionaryValue>& config); |
| 55 Response End(DevToolsCommandId command_id); | 57 Response End(DevToolsCommandId command_id); |
| 56 Response GetCategories(DevToolsCommandId command); | 58 Response GetCategories(DevToolsCommandId command); |
| 57 Response RequestMemoryDump(DevToolsCommandId command_id); | 59 Response RequestMemoryDump(DevToolsCommandId command_id); |
| 58 Response RecordClockSyncMarker(const std::string& sync_id); | 60 Response RecordClockSyncMarker(const std::string& sync_id); |
| 59 | 61 |
| 60 bool did_initiate_recording() { return did_initiate_recording_; } | 62 bool did_initiate_recording() { return did_initiate_recording_; } |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 void OnRecordingEnabled(DevToolsCommandId command_id); | 65 void OnRecordingEnabled(DevToolsCommandId command_id); |
| 64 void OnBufferUsage(float percent_full, size_t approximate_event_count); | 66 void OnBufferUsage(float percent_full, size_t approximate_event_count); |
| 65 void OnCategoriesReceived(DevToolsCommandId command_id, | 67 void OnCategoriesReceived(DevToolsCommandId command_id, |
| 66 const std::set<std::string>& category_set); | 68 const std::set<std::string>& category_set); |
| 67 void OnMemoryDumpFinished(DevToolsCommandId command_id, | 69 void OnMemoryDumpFinished(DevToolsCommandId command_id, |
| 68 uint64_t dump_guid, | 70 uint64_t dump_guid, |
| 69 bool success); | 71 bool success); |
| 70 | 72 |
| 71 void SetupTimer(double usage_reporting_interval); | 73 void SetupTimer(double usage_reporting_interval); |
| 72 void StopTracing( | 74 void StopTracing( |
| 73 const scoped_refptr<TracingController::TraceDataSink>& trace_data_sink); | 75 const scoped_refptr<TracingController::TraceDataSink>& trace_data_sink); |
| 74 bool IsTracing() const; | 76 bool IsTracing() const; |
| 75 static bool IsStartupTracingActive(); | 77 static bool IsStartupTracingActive(); |
| 78 static base::trace_event::TraceConfig GetTraceConfigFromDevtoolsConfig( |
| 79 const base::DictionaryValue& devtools_config); |
| 76 | 80 |
| 77 scoped_ptr<base::Timer> buffer_usage_poll_timer_; | 81 scoped_ptr<base::Timer> buffer_usage_poll_timer_; |
| 78 Target target_; | 82 Target target_; |
| 79 | 83 |
| 80 scoped_ptr<Client> client_; | 84 scoped_ptr<Client> client_; |
| 81 DevToolsIOContext* io_context_; | 85 DevToolsIOContext* io_context_; |
| 82 int frame_tree_node_id_; | 86 int frame_tree_node_id_; |
| 83 bool did_initiate_recording_; | 87 bool did_initiate_recording_; |
| 84 bool return_as_stream_; | 88 bool return_as_stream_; |
| 85 base::WeakPtrFactory<TracingHandler> weak_factory_; | 89 base::WeakPtrFactory<TracingHandler> weak_factory_; |
| 86 | 90 |
| 91 FRIEND_TEST_ALL_PREFIXES(TracingHandlerTest, |
| 92 GetTraceConfigFromDevtoolsConfig); |
| 87 DISALLOW_COPY_AND_ASSIGN(TracingHandler); | 93 DISALLOW_COPY_AND_ASSIGN(TracingHandler); |
| 88 }; | 94 }; |
| 89 | 95 |
| 90 } // namespace tracing | 96 } // namespace tracing |
| 91 } // namespace devtools | 97 } // namespace devtools |
| 92 } // namespace content | 98 } // namespace content |
| 93 | 99 |
| 94 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ | 100 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_ |
| OLD | NEW |