| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TRACING_TRACE_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/trace_event/memory_dump_request_args.h" |
| 14 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 15 #include "content/public/browser/browser_message_filter.h" | 16 #include "content/public/browser/browser_message_filter.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 // This class sends and receives trace messages on the browser process. | 20 // This class sends and receives trace messages on the browser process. |
| 20 // See also: tracing_controller.h | 21 // See also: tracing_controller.h |
| 21 // See also: child_trace_message_filter.h | 22 // See also: child_trace_message_filter.h |
| 22 class TraceMessageFilter : public BrowserMessageFilter { | 23 class TraceMessageFilter : public BrowserMessageFilter { |
| 23 public: | 24 public: |
| 24 explicit TraceMessageFilter(int child_process_id); | 25 explicit TraceMessageFilter(int child_process_id); |
| 25 | 26 |
| 26 // BrowserMessageFilter implementation. | 27 // BrowserMessageFilter implementation. |
| 27 void OnChannelClosing() override; | 28 void OnChannelClosing() override; |
| 28 bool OnMessageReceived(const IPC::Message& message) override; | 29 bool OnMessageReceived(const IPC::Message& message) override; |
| 29 | 30 |
| 30 void SendBeginTracing( | 31 void SendBeginTracing( |
| 31 const base::trace_event::TraceConfig& trace_config); | 32 const base::trace_event::TraceConfig& trace_config); |
| 32 void SendEndTracing(); | 33 void SendEndTracing(); |
| 33 void SendCancelTracing(); | 34 void SendCancelTracing(); |
| 34 void SendGetTraceLogStatus(); | 35 void SendGetTraceLogStatus(); |
| 35 void SendSetWatchEvent(const std::string& category_name, | 36 void SendSetWatchEvent(const std::string& category_name, |
| 36 const std::string& event_name); | 37 const std::string& event_name); |
| 37 void SendCancelWatchEvent(); | 38 void SendCancelWatchEvent(); |
| 39 void SendProcessMemoryDumpRequest( |
| 40 const base::trace_event::MemoryDumpRequestArgs& args); |
| 38 | 41 |
| 39 protected: | 42 protected: |
| 40 ~TraceMessageFilter() override; | 43 ~TraceMessageFilter() override; |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 // Message handlers. | 46 // Message handlers. |
| 44 void OnChildSupportsTracing(); | 47 void OnChildSupportsTracing(); |
| 45 void OnEndTracingAck(const std::vector<std::string>& known_categories); | 48 void OnEndTracingAck(const std::vector<std::string>& known_categories); |
| 46 void OnWatchEventMatched(); | 49 void OnWatchEventMatched(); |
| 47 void OnTraceLogStatusReply(const base::trace_event::TraceLogStatus& status); | 50 void OnTraceLogStatusReply(const base::trace_event::TraceLogStatus& status); |
| 48 void OnTraceDataCollected(const std::string& data); | 51 void OnTraceDataCollected(const std::string& data); |
| 52 void OnGlobalMemoryDumpRequest( |
| 53 const base::trace_event::MemoryDumpRequestArgs& args); |
| 54 void OnProcessMemoryDumpResponse(uint64_t dump_guid, bool success); |
| 55 |
| 56 void SendGlobalMemoryDumpResponse(uint64_t dump_guid, bool success); |
| 49 void OnTriggerBackgroundTrace(const std::string& histogram_name); | 57 void OnTriggerBackgroundTrace(const std::string& histogram_name); |
| 50 void OnAbortBackgroundTrace(); | 58 void OnAbortBackgroundTrace(); |
| 51 | 59 |
| 52 // ChildTraceMessageFilter exists: | 60 // ChildTraceMessageFilter exists: |
| 53 bool has_child_; | 61 bool has_child_; |
| 54 | 62 |
| 55 // Hash of id of the child process. | 63 // Hash of id of the child process. |
| 56 uint64_t tracing_process_id_; | 64 uint64_t tracing_process_id_; |
| 57 | 65 |
| 58 // Awaiting ack for previously sent SendEndTracing | 66 // Awaiting ack for previously sent SendEndTracing |
| 59 bool is_awaiting_end_ack_; | 67 bool is_awaiting_end_ack_; |
| 60 // Awaiting ack for previously sent SendGetTraceLogStatus | 68 // Awaiting ack for previously sent SendGetTraceLogStatus |
| 61 bool is_awaiting_buffer_percent_full_ack_; | 69 bool is_awaiting_buffer_percent_full_ack_; |
| 62 | 70 |
| 63 DISALLOW_COPY_AND_ASSIGN(TraceMessageFilter); | 71 DISALLOW_COPY_AND_ASSIGN(TraceMessageFilter); |
| 64 }; | 72 }; |
| 65 | 73 |
| 66 } // namespace content | 74 } // namespace content |
| 67 | 75 |
| 68 #endif // CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_ | 76 #endif // CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_ |
| OLD | NEW |