| 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 #include "content/browser/tracing/tracing_ui.h" | 5 #include "content/browser/tracing/tracing_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 int tracing_options = 0; | 81 int tracing_options = 0; |
| 82 if (use_system_tracing) | 82 if (use_system_tracing) |
| 83 tracing_options |= TracingController::ENABLE_SYSTRACE; | 83 tracing_options |= TracingController::ENABLE_SYSTRACE; |
| 84 if (use_sampling) | 84 if (use_sampling) |
| 85 tracing_options |= TracingController::ENABLE_SAMPLING; | 85 tracing_options |= TracingController::ENABLE_SAMPLING; |
| 86 if (use_continuous_tracing) | 86 if (use_continuous_tracing) |
| 87 tracing_options |= TracingController::RECORD_CONTINUOUSLY; | 87 tracing_options |= TracingController::RECORD_CONTINUOUSLY; |
| 88 | 88 |
| 89 base::debug::CategoryFilter category_filter(category_filter_string); |
| 89 return TracingController::GetInstance()->EnableRecording( | 90 return TracingController::GetInstance()->EnableRecording( |
| 90 category_filter_string, | 91 category_filter, |
| 91 static_cast<TracingController::Options>(tracing_options), | 92 static_cast<TracingController::Options>(tracing_options), |
| 92 base::Bind(&OnRecordingEnabledAck, callback)); | 93 base::Bind(OnRecordingEnabledAck, callback)); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void OnRecordingEnabledAck(const WebUIDataSource::GotDataCallback& callback) { | 96 void OnRecordingEnabledAck(const WebUIDataSource::GotDataCallback& callback) { |
| 96 base::RefCountedString* res = new base::RefCountedString(); | 97 base::RefCountedString* res = new base::RefCountedString(); |
| 97 callback.Run(res); | 98 callback.Run(res); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void OnTraceBufferPercentFullResult( | 101 void OnTraceBufferPercentFullResult( |
| 101 const WebUIDataSource::GotDataCallback& callback, float result) { | 102 const WebUIDataSource::GotDataCallback& callback, float result) { |
| 102 std::string str = base::DoubleToString(result); | 103 std::string str = base::DoubleToString(result); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 162 |
| 162 WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); | 163 WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); |
| 163 source->SetJsonPath("strings.js"); | 164 source->SetJsonPath("strings.js"); |
| 164 source->SetDefaultResource(IDR_TRACING_HTML); | 165 source->SetDefaultResource(IDR_TRACING_HTML); |
| 165 source->AddResourcePath("tracing.js", IDR_TRACING_JS); | 166 source->AddResourcePath("tracing.js", IDR_TRACING_JS); |
| 166 source->SetRequestFilter(base::Bind(OnBeginRequest)); | 167 source->SetRequestFilter(base::Bind(OnBeginRequest)); |
| 167 WebUIDataSource::Add(browser_context, source); | 168 WebUIDataSource::Add(browser_context, source); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace content | 171 } // namespace content |
| OLD | NEW |