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