| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/feedback/tracing_manager.h" | 5 #include "components/feedback/tracing_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "components/feedback/feedback_util.h" | 10 #include "components/feedback/feedback_util.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // If the trace has already been requested, provide an empty string. | 83 // If the trace has already been requested, provide an empty string. |
| 84 if (!trace_callback_.is_null()) { | 84 if (!trace_callback_.is_null()) { |
| 85 trace_callback_.Run(scoped_refptr<base::RefCountedString>()); | 85 trace_callback_.Run(scoped_refptr<base::RefCountedString>()); |
| 86 trace_callback_.Reset(); | 86 trace_callback_.Reset(); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void TracingManager::StartTracing() { | 91 void TracingManager::StartTracing() { |
| 92 content::TracingController::GetInstance()->EnableRecording( | 92 content::TracingController::GetInstance()->EnableRecording( |
| 93 base::debug::CategoryFilter(), | 93 base::trace_event::CategoryFilter(), |
| 94 base::debug::TraceOptions(), | 94 base::trace_event::TraceOptions(), |
| 95 content::TracingController::EnableRecordingDoneCallback()); | 95 content::TracingController::EnableRecordingDoneCallback()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void TracingManager::OnTraceDataCollected(base::RefCountedString* trace_data) { | 98 void TracingManager::OnTraceDataCollected(base::RefCountedString* trace_data) { |
| 99 if (!current_trace_id_) | 99 if (!current_trace_id_) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 std::string output_val; | 102 std::string output_val; |
| 103 feedback_util::ZipString( | 103 feedback_util::ZipString( |
| 104 base::FilePath(kTracingFilename), trace_data->data(), &output_val); | 104 base::FilePath(kTracingFilename), trace_data->data(), &output_val); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 126 // static | 126 // static |
| 127 scoped_ptr<TracingManager> TracingManager::Create() { | 127 scoped_ptr<TracingManager> TracingManager::Create() { |
| 128 if (g_tracing_manager) | 128 if (g_tracing_manager) |
| 129 return scoped_ptr<TracingManager>(); | 129 return scoped_ptr<TracingManager>(); |
| 130 return scoped_ptr<TracingManager>(new TracingManager()); | 130 return scoped_ptr<TracingManager>(new TracingManager()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 TracingManager* TracingManager::Get() { | 133 TracingManager* TracingManager::Get() { |
| 134 return g_tracing_manager; | 134 return g_tracing_manager; |
| 135 } | 135 } |
| OLD | NEW |