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_TRACE_CONTROLLER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_TRACE_CONTROLLER_IMPL_H_ |
6 #define CONTENT_BROWSER_TRACE_CONTROLLER_IMPL_H_ | 6 #define CONTENT_BROWSER_TRACE_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/lazy_instance.h" |
14 #include "content/public/browser/trace_controller.h" | 14 #include "content/public/browser/trace_controller.h" |
15 | 15 |
16 class CommandLine; | 16 class CommandLine; |
17 class TraceMessageFilter; | 17 class TraceMessageFilter; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class TraceControllerImpl : public TraceController { | 21 class TraceControllerImpl : public TraceController { |
22 public: | 22 public: |
23 static TraceControllerImpl* GetInstance(); | 23 static TraceControllerImpl* GetInstance(); |
(...skipping 15 matching lines...) Expand all Loading... |
39 bool BeginTracing(TraceSubscriber* subscriber, | 39 bool BeginTracing(TraceSubscriber* subscriber, |
40 const std::vector<std::string>& included_categories, | 40 const std::vector<std::string>& included_categories, |
41 const std::vector<std::string>& excluded_categories); | 41 const std::vector<std::string>& excluded_categories); |
42 | 42 |
43 // TraceController implementation: | 43 // TraceController implementation: |
44 virtual bool BeginTracing(TraceSubscriber* subscriber, | 44 virtual bool BeginTracing(TraceSubscriber* subscriber, |
45 const std::string& categories) OVERRIDE; | 45 const std::string& categories) OVERRIDE; |
46 virtual bool EndTracingAsync(TraceSubscriber* subscriber) OVERRIDE; | 46 virtual bool EndTracingAsync(TraceSubscriber* subscriber) OVERRIDE; |
47 virtual bool GetTraceBufferPercentFullAsync( | 47 virtual bool GetTraceBufferPercentFullAsync( |
48 TraceSubscriber* subscriber) OVERRIDE; | 48 TraceSubscriber* subscriber) OVERRIDE; |
| 49 virtual bool SetWatchEvent(TraceSubscriber* subscriber, |
| 50 const std::string& category_name, |
| 51 const std::string& event_name) OVERRIDE; |
| 52 virtual bool CancelWatchEvent(TraceSubscriber* subscriber) OVERRIDE; |
49 virtual void CancelSubscriber(TraceSubscriber* subscriber) OVERRIDE; | 53 virtual void CancelSubscriber(TraceSubscriber* subscriber) OVERRIDE; |
50 | 54 |
51 private: | 55 private: |
52 typedef std::set<scoped_refptr<TraceMessageFilter> > FilterMap; | 56 typedef std::set<scoped_refptr<TraceMessageFilter> > FilterMap; |
53 | 57 |
54 friend struct DefaultSingletonTraits<TraceControllerImpl>; | 58 friend struct base::DefaultLazyInstanceTraits<TraceControllerImpl>; |
55 friend class ::TraceMessageFilter; | 59 friend class ::TraceMessageFilter; |
56 | 60 |
57 TraceControllerImpl(); | 61 TraceControllerImpl(); |
58 virtual ~TraceControllerImpl(); | 62 virtual ~TraceControllerImpl(); |
59 | 63 |
60 bool is_tracing_enabled() const { | 64 bool is_tracing_enabled() const { |
61 return can_end_tracing(); | 65 return can_end_tracing(); |
62 } | 66 } |
63 | 67 |
64 bool can_end_tracing() const { | 68 bool can_end_tracing() const { |
(...skipping 13 matching lines...) Expand all Loading... |
78 } | 82 } |
79 | 83 |
80 // Methods for use by TraceMessageFilter. | 84 // Methods for use by TraceMessageFilter. |
81 | 85 |
82 void AddFilter(TraceMessageFilter* filter); | 86 void AddFilter(TraceMessageFilter* filter); |
83 void RemoveFilter(TraceMessageFilter* filter); | 87 void RemoveFilter(TraceMessageFilter* filter); |
84 void OnTracingBegan(TraceSubscriber* subscriber); | 88 void OnTracingBegan(TraceSubscriber* subscriber); |
85 void OnEndTracingAck(const std::vector<std::string>& known_categories); | 89 void OnEndTracingAck(const std::vector<std::string>& known_categories); |
86 void OnTraceDataCollected( | 90 void OnTraceDataCollected( |
87 const scoped_refptr<base::RefCountedString>& events_str_ptr); | 91 const scoped_refptr<base::RefCountedString>& events_str_ptr); |
88 void OnTraceBufferFull(); | 92 void OnTraceNotification(int notification); |
89 void OnTraceBufferPercentFullReply(float percent_full); | 93 void OnTraceBufferPercentFullReply(float percent_full); |
90 | 94 |
91 FilterMap filters_; | 95 FilterMap filters_; |
92 TraceSubscriber* subscriber_; | 96 TraceSubscriber* subscriber_; |
93 // Pending acks for EndTracingAsync: | 97 // Pending acks for EndTracingAsync: |
94 int pending_end_ack_count_; | 98 int pending_end_ack_count_; |
95 // Pending acks for GetTraceBufferPercentFullAsync: | 99 // Pending acks for GetTraceBufferPercentFullAsync: |
96 int pending_bpf_ack_count_; | 100 int pending_bpf_ack_count_; |
97 float maximum_bpf_; | 101 float maximum_bpf_; |
98 bool is_tracing_; | 102 bool is_tracing_; |
99 bool is_get_categories_; | 103 bool is_get_categories_; |
100 std::set<std::string> known_categories_; | 104 std::set<std::string> known_categories_; |
101 std::vector<std::string> included_categories_; | 105 std::vector<std::string> included_categories_; |
102 std::vector<std::string> excluded_categories_; | 106 std::vector<std::string> excluded_categories_; |
| 107 std::string watch_category_; |
| 108 std::string watch_name_; |
103 | 109 |
104 DISALLOW_COPY_AND_ASSIGN(TraceControllerImpl); | 110 DISALLOW_COPY_AND_ASSIGN(TraceControllerImpl); |
105 }; | 111 }; |
106 | 112 |
107 } // namespace content | 113 } // namespace content |
108 | 114 |
109 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_IMPL_H_ | 115 #endif // CONTENT_BROWSER_TRACE_CONTROLLER_IMPL_H_ |
110 | 116 |
OLD | NEW |