Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: components/tracing/child/child_trace_message_filter.h

Issue 2724793002: Revert of memory-infra: Finish moving memory_infra from TracingController (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 COMPONENTS_TRACING_CHILD_CHILD_TRACE_MESSAGE_FILTER_H_ 5 #ifndef COMPONENTS_TRACING_CHILD_CHILD_TRACE_MESSAGE_FILTER_H_
6 #define COMPONENTS_TRACING_CHILD_CHILD_TRACE_MESSAGE_FILTER_H_ 6 #define COMPONENTS_TRACING_CHILD_CHILD_TRACE_MESSAGE_FILTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/trace_event/memory_dump_request_args.h"
15 #include "components/tracing/tracing_export.h" 16 #include "components/tracing/tracing_export.h"
16 #include "ipc/message_filter.h" 17 #include "ipc/message_filter.h"
17 18
18 namespace base { 19 namespace base {
19 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
20 } 21 }
21 22
22 namespace tracing { 23 namespace tracing {
23 24
24 // This class sends and receives trace messages on child processes. 25 // This class sends and receives trace messages on child processes.
25 class TRACING_EXPORT ChildTraceMessageFilter : public IPC::MessageFilter { 26 class TRACING_EXPORT ChildTraceMessageFilter : public IPC::MessageFilter {
26 public: 27 public:
27 explicit ChildTraceMessageFilter( 28 explicit ChildTraceMessageFilter(
28 base::SingleThreadTaskRunner* ipc_task_runner); 29 base::SingleThreadTaskRunner* ipc_task_runner);
29 30
30 // IPC::MessageFilter implementation. 31 // IPC::MessageFilter implementation.
31 void OnFilterAdded(IPC::Channel* channel) override; 32 void OnFilterAdded(IPC::Channel* channel) override;
32 void OnFilterRemoved() override; 33 void OnFilterRemoved() override;
33 bool OnMessageReceived(const IPC::Message& message) override; 34 bool OnMessageReceived(const IPC::Message& message) override;
34 35
36 void SendGlobalMemoryDumpRequest(
37 const base::trace_event::MemoryDumpRequestArgs& args,
38 const base::trace_event::MemoryDumpCallback& callback);
39
35 base::SingleThreadTaskRunner* ipc_task_runner() const { 40 base::SingleThreadTaskRunner* ipc_task_runner() const {
36 return ipc_task_runner_; 41 return ipc_task_runner_;
37 } 42 }
38 43
39 protected: 44 protected:
40 ~ChildTraceMessageFilter() override; 45 ~ChildTraceMessageFilter() override;
41 46
42 private: 47 private:
43 friend class ChildTraceMessageFilterTest; 48 friend class ChildTraceMessageFilterTest;
44 49
45 // Message handlers. 50 // Message handlers.
46 void OnBeginTracing(const std::string& trace_config_str, 51 void OnBeginTracing(const std::string& trace_config_str,
47 base::TimeTicks browser_time, 52 base::TimeTicks browser_time,
48 uint64_t tracing_process_id); 53 uint64_t tracing_process_id);
49 void OnEndTracing(); 54 void OnEndTracing();
50 void OnCancelTracing(); 55 void OnCancelTracing();
51 void OnGetTraceLogStatus(); 56 void OnGetTraceLogStatus();
52 void OnSetWatchEvent(const std::string& category_name, 57 void OnSetWatchEvent(const std::string& category_name,
53 const std::string& event_name); 58 const std::string& event_name);
54 void OnCancelWatchEvent(); 59 void OnCancelWatchEvent();
55 void OnWatchEventMatched(); 60 void OnWatchEventMatched();
61 void OnProcessMemoryDumpRequest(
62 const base::trace_event::MemoryDumpRequestArgs& args);
63 void OnGlobalMemoryDumpResponse(uint64_t dump_guid, bool success);
56 void OnSetUMACallback(const std::string& histogram_name, 64 void OnSetUMACallback(const std::string& histogram_name,
57 int histogram_lower_value, 65 int histogram_lower_value,
58 int histogram_upper_value, 66 int histogram_upper_value,
59 bool repeat); 67 bool repeat);
60 void OnClearUMACallback(const std::string& histogram_name); 68 void OnClearUMACallback(const std::string& histogram_name);
61 void OnHistogramChanged(const std::string& histogram_name, 69 void OnHistogramChanged(const std::string& histogram_name,
62 base::Histogram::Sample reference_lower_value, 70 base::Histogram::Sample reference_lower_value,
63 base::Histogram::Sample reference_upper_value, 71 base::Histogram::Sample reference_upper_value,
64 bool repeat, 72 bool repeat,
65 base::Histogram::Sample actual_value); 73 base::Histogram::Sample actual_value);
66 void SendTriggerMessage(const std::string& histogram_name); 74 void SendTriggerMessage(const std::string& histogram_name);
67 void SendAbortBackgroundTracingMessage(); 75 void SendAbortBackgroundTracingMessage();
68 76
69 // Callback from trace subsystem. 77 // Callback from trace subsystem.
70 void OnTraceDataCollected( 78 void OnTraceDataCollected(
71 const scoped_refptr<base::RefCountedString>& events_str_ptr, 79 const scoped_refptr<base::RefCountedString>& events_str_ptr,
72 bool has_more_events); 80 bool has_more_events);
73 81
82 void OnProcessMemoryDumpDone(uint64_t dump_guid, bool success);
83
74 void SetSenderForTesting(IPC::Sender* sender); 84 void SetSenderForTesting(IPC::Sender* sender);
75 85
76 IPC::Sender* sender_; 86 IPC::Sender* sender_;
77 base::SingleThreadTaskRunner* ipc_task_runner_; 87 base::SingleThreadTaskRunner* ipc_task_runner_;
78 88
89 // guid of the outstanding request (to the Browser's MemoryDumpManager), if
90 // any. 0 if there is no request pending.
91 uint64_t pending_memory_dump_guid_;
92
93 // callback of the outstanding memory dump request, if any.
94 base::trace_event::MemoryDumpCallback pending_memory_dump_callback_;
95
79 base::Time histogram_last_changed_; 96 base::Time histogram_last_changed_;
80 97
81 DISALLOW_COPY_AND_ASSIGN(ChildTraceMessageFilter); 98 DISALLOW_COPY_AND_ASSIGN(ChildTraceMessageFilter);
82 }; 99 };
83 100
84 } // namespace tracing 101 } // namespace tracing
85 102
86 #endif // COMPONENTS_TRACING_CHILD_CHILD_TRACE_MESSAGE_FILTER_H_ 103 #endif // COMPONENTS_TRACING_CHILD_CHILD_TRACE_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698