OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/test/base/tracing.h" | 5 #include "chrome/test/base/tracing.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
10 #include "content/browser/trace_controller.h" | 10 #include "content/browser/trace_controller.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 private: | 46 private: |
47 friend struct DefaultSingletonTraits<InProcessTraceController>; | 47 friend struct DefaultSingletonTraits<InProcessTraceController>; |
48 | 48 |
49 // TraceSubscriber | 49 // TraceSubscriber |
50 virtual void OnEndTracingComplete() OVERRIDE { | 50 virtual void OnEndTracingComplete() OVERRIDE { |
51 MessageLoopForUI::current()->Quit(); | 51 MessageLoopForUI::current()->Quit(); |
52 } | 52 } |
53 | 53 |
54 // TraceSubscriber | 54 // TraceSubscriber |
55 virtual void OnTraceDataCollected(const std::string& trace_fragment) | 55 virtual void OnTraceDataCollected( |
56 OVERRIDE { | 56 const scoped_refptr<base::RefCountedString>& trace_fragment) OVERRIDE { |
57 trace_buffer_.AddFragment(trace_fragment); | 57 trace_buffer_.AddFragment(trace_fragment->data()); |
58 } | 58 } |
59 | 59 |
60 // For collecting trace data asynchronously. | 60 // For collecting trace data asynchronously. |
61 base::debug::TraceResultBuffer trace_buffer_; | 61 base::debug::TraceResultBuffer trace_buffer_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(InProcessTraceController); | 63 DISALLOW_COPY_AND_ASSIGN(InProcessTraceController); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 namespace tracing { | 68 namespace tracing { |
69 | 69 |
70 bool BeginTracing(const std::string& categories) { | 70 bool BeginTracing(const std::string& categories) { |
71 return InProcessTraceController::GetInstance()->BeginTracing(categories); | 71 return InProcessTraceController::GetInstance()->BeginTracing(categories); |
72 } | 72 } |
73 | 73 |
74 bool EndTracing(std::string* json_trace_output) { | 74 bool EndTracing(std::string* json_trace_output) { |
75 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output); | 75 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output); |
76 } | 76 } |
77 | 77 |
78 } // namespace tracing | 78 } // namespace tracing |
79 | 79 |
OLD | NEW |