Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: content/browser/devtools/protocol/tracing_handler.cc

Issue 892213004: Mechanical rename of base::debug -> base::trace_event for /content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_trace_part3_1
Patch Set: Rebase. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/devtools/protocol/tracing_handler.h" 5 #include "content/browser/devtools/protocol/tracing_handler.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 Response TracingHandler::Start(DevToolsCommandId command_id, 86 Response TracingHandler::Start(DevToolsCommandId command_id,
87 const std::string* categories, 87 const std::string* categories,
88 const std::string* options_str, 88 const std::string* options_str,
89 const double* buffer_usage_reporting_interval) { 89 const double* buffer_usage_reporting_interval) {
90 if (is_recording_) 90 if (is_recording_)
91 return Response::InternalError("Tracing is already started"); 91 return Response::InternalError("Tracing is already started");
92 92
93 is_recording_ = true; 93 is_recording_ = true;
94 base::debug::TraceOptions options = TraceOptionsFromString(options_str); 94 base::trace_event::TraceOptions options = TraceOptionsFromString(options_str);
95 base::debug::CategoryFilter filter(categories ? *categories : std::string()); 95 base::trace_event::CategoryFilter filter(categories ? *categories
96 : std::string());
96 if (buffer_usage_reporting_interval) 97 if (buffer_usage_reporting_interval)
97 SetupTimer(*buffer_usage_reporting_interval); 98 SetupTimer(*buffer_usage_reporting_interval);
98 99
99 // If inspected target is a render process Tracing.start will be handled by 100 // If inspected target is a render process Tracing.start will be handled by
100 // tracing agent in the renderer. 101 // tracing agent in the renderer.
101 if (target_ == Renderer) { 102 if (target_ == Renderer) {
102 TracingController::GetInstance()->EnableRecording( 103 TracingController::GetInstance()->EnableRecording(
103 filter, 104 filter,
104 options, 105 options,
105 TracingController::EnableRecordingDoneCallback()); 106 TracingController::EnableRecordingDoneCallback());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void TracingHandler::OnCategoriesReceived( 151 void TracingHandler::OnCategoriesReceived(
151 DevToolsCommandId command_id, 152 DevToolsCommandId command_id,
152 const std::set<std::string>& category_set) { 153 const std::set<std::string>& category_set) {
153 std::vector<std::string> categories; 154 std::vector<std::string> categories;
154 for (const std::string& category : category_set) 155 for (const std::string& category : category_set)
155 categories.push_back(category); 156 categories.push_back(category);
156 client_->SendGetCategoriesResponse(command_id, 157 client_->SendGetCategoriesResponse(command_id,
157 GetCategoriesResponse::Create()->set_categories(categories)); 158 GetCategoriesResponse::Create()->set_categories(categories));
158 } 159 }
159 160
160 base::debug::TraceOptions TracingHandler::TraceOptionsFromString( 161 base::trace_event::TraceOptions TracingHandler::TraceOptionsFromString(
161 const std::string* options) { 162 const std::string* options) {
162 base::debug::TraceOptions ret; 163 base::trace_event::TraceOptions ret;
163 if (!options) 164 if (!options)
164 return ret; 165 return ret;
165 166
166 std::vector<std::string> split; 167 std::vector<std::string> split;
167 std::vector<std::string>::iterator iter; 168 std::vector<std::string>::iterator iter;
168 169
169 base::SplitString(*options, ',', &split); 170 base::SplitString(*options, ',', &split);
170 for (iter = split.begin(); iter != split.end(); ++iter) { 171 for (iter = split.begin(); iter != split.end(); ++iter) {
171 if (*iter == kRecordUntilFull) { 172 if (*iter == kRecordUntilFull) {
172 ret.record_mode = base::debug::RECORD_UNTIL_FULL; 173 ret.record_mode = base::trace_event::RECORD_UNTIL_FULL;
173 } else if (*iter == kRecordContinuously) { 174 } else if (*iter == kRecordContinuously) {
174 ret.record_mode = base::debug::RECORD_CONTINUOUSLY; 175 ret.record_mode = base::trace_event::RECORD_CONTINUOUSLY;
175 } else if (*iter == kRecordAsMuchAsPossible) { 176 } else if (*iter == kRecordAsMuchAsPossible) {
176 ret.record_mode = base::debug::RECORD_AS_MUCH_AS_POSSIBLE; 177 ret.record_mode = base::trace_event::RECORD_AS_MUCH_AS_POSSIBLE;
177 } else if (*iter == kEnableSampling) { 178 } else if (*iter == kEnableSampling) {
178 ret.enable_sampling = true; 179 ret.enable_sampling = true;
179 } 180 }
180 } 181 }
181 return ret; 182 return ret;
182 } 183 }
183 184
184 void TracingHandler::SetupTimer(double usage_reporting_interval) { 185 void TracingHandler::SetupTimer(double usage_reporting_interval) {
185 if (usage_reporting_interval == 0) return; 186 if (usage_reporting_interval == 0) return;
186 187
(...skipping 15 matching lines...) Expand all
202 void TracingHandler::DisableRecording(bool abort) { 203 void TracingHandler::DisableRecording(bool abort) {
203 is_recording_ = false; 204 is_recording_ = false;
204 buffer_usage_poll_timer_.reset(); 205 buffer_usage_poll_timer_.reset();
205 TracingController::GetInstance()->DisableRecording( 206 TracingController::GetInstance()->DisableRecording(
206 abort ? nullptr : new DevToolsTraceSinkProxy(weak_factory_.GetWeakPtr())); 207 abort ? nullptr : new DevToolsTraceSinkProxy(weak_factory_.GetWeakPtr()));
207 } 208 }
208 209
209 } // namespace tracing 210 } // namespace tracing
210 } // namespace devtools 211 } // namespace devtools
211 } // namespace content 212 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/tracing_handler.h ('k') | content/browser/media/webrtc_getusermedia_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698