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