| 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); | |
| 90 return TracingController::GetInstance()->EnableRecording( | 89 return TracingController::GetInstance()->EnableRecording( |
| 91 category_filter, | 90 category_filter_string, |
| 92 static_cast<TracingController::Options>(tracing_options), | 91 static_cast<TracingController::Options>(tracing_options), |
| 93 base::Bind(OnRecordingEnabledAck, callback)); | 92 base::Bind(&OnRecordingEnabledAck, callback)); |
| 94 } | 93 } |
| 95 | 94 |
| 96 void OnRecordingEnabledAck(const WebUIDataSource::GotDataCallback& callback) { | 95 void OnRecordingEnabledAck(const WebUIDataSource::GotDataCallback& callback) { |
| 97 base::RefCountedString* res = new base::RefCountedString(); | 96 base::RefCountedString* res = new base::RefCountedString(); |
| 98 callback.Run(res); | 97 callback.Run(res); |
| 99 } | 98 } |
| 100 | 99 |
| 101 void OnTraceBufferPercentFullResult( | 100 void OnTraceBufferPercentFullResult( |
| 102 const WebUIDataSource::GotDataCallback& callback, float result) { | 101 const WebUIDataSource::GotDataCallback& callback, float result) { |
| 103 std::string str = base::DoubleToString(result); | 102 std::string str = base::DoubleToString(result); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 161 |
| 163 WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); | 162 WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); |
| 164 source->SetJsonPath("strings.js"); | 163 source->SetJsonPath("strings.js"); |
| 165 source->SetDefaultResource(IDR_TRACING_HTML); | 164 source->SetDefaultResource(IDR_TRACING_HTML); |
| 166 source->AddResourcePath("tracing.js", IDR_TRACING_JS); | 165 source->AddResourcePath("tracing.js", IDR_TRACING_JS); |
| 167 source->SetRequestFilter(base::Bind(OnBeginRequest)); | 166 source->SetRequestFilter(base::Bind(OnBeginRequest)); |
| 168 WebUIDataSource::Add(browser_context, source); | 167 WebUIDataSource::Add(browser_context, source); |
| 169 } | 168 } |
| 170 | 169 |
| 171 } // namespace content | 170 } // namespace content |
| OLD | NEW |