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