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