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

Side by Side Diff: content/renderer/devtools/devtools_agent.cc

Issue 1765153002: Update DevTools Tracing.Start to accept trace config as a parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 (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/renderer/devtools/devtools_agent.h" 5 #include "content/renderer/devtools/devtools_agent.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 bool DevToolsAgent::requestDevToolsForFrame(blink::WebLocalFrame* webFrame) { 135 bool DevToolsAgent::requestDevToolsForFrame(blink::WebLocalFrame* webFrame) {
136 RenderFrameImpl* frame = RenderFrameImpl::FromWebFrame(webFrame); 136 RenderFrameImpl* frame = RenderFrameImpl::FromWebFrame(webFrame);
137 if (!frame) 137 if (!frame)
138 return false; 138 return false;
139 Send(new DevToolsAgentHostMsg_RequestNewWindow(routing_id(), 139 Send(new DevToolsAgentHostMsg_RequestNewWindow(routing_id(),
140 frame->GetRoutingID())); 140 frame->GetRoutingID()));
141 return true; 141 return true;
142 } 142 }
143 143
144 void DevToolsAgent::enableTracing(const WebString& category_filter) { 144 void DevToolsAgent::enableTracingWithTraceConfig(
145 const base::trace_event::TraceConfig& trace_config) {
145 // Tracing is already started by DevTools TracingHandler::Start for the 146 // Tracing is already started by DevTools TracingHandler::Start for the
146 // renderer target in the browser process. It will eventually start tracing in 147 // renderer target in the browser process. It will eventually start tracing in
147 // the renderer process via IPC. But we still need a redundant 148 // the renderer process via IPC. But we still need a redundant
148 // TraceLog::SetEnabled call here for 149 // TraceLog::SetEnabled call here for
149 // InspectorTracingAgent::emitMetadataEvents(), at which point, we are not 150 // InspectorTracingAgent::emitMetadataEvents(), at which point, we are not
150 // sure if tracing is already started in the renderer process. 151 // sure if tracing is already started in the renderer process.
151 TraceLog* trace_log = TraceLog::GetInstance(); 152 TraceLog* trace_log = TraceLog::GetInstance();
152 trace_log->SetEnabled( 153 trace_log->SetEnabled(trace_config, TraceLog::RECORDING_MODE);
153 base::trace_event::TraceConfig(category_filter.utf8(), ""), 154 }
154 TraceLog::RECORDING_MODE); 155
156 void DevToolsAgent::enableTracingWithConfigStr(
157 const WebString& devtools_style_config) {
158 base::trace_event::TraceConfig trace_config(
159 base::trace_event::TraceConfig::DevToolsToTracingStyle(
160 devtools_style_config.utf8()));
161 enableTracingWithTraceConfig(trace_config);
162 }
163
164 void DevToolsAgent::enableTracing(const WebString& category_filter) {
165 base::trace_event::TraceConfig trace_config(category_filter.utf8(), "");
166 enableTracingWithTraceConfig(trace_config);
155 } 167 }
156 168
157 void DevToolsAgent::disableTracing() { 169 void DevToolsAgent::disableTracing() {
158 TraceLog::GetInstance()->SetDisabled(); 170 TraceLog::GetInstance()->SetDisabled();
159 } 171 }
160 172
161 void DevToolsAgent::setCPUThrottlingRate(double rate) { 173 void DevToolsAgent::setCPUThrottlingRate(double rate) {
162 cpu_throttler_->SetThrottlingRate(rate); 174 cpu_throttler_->SetThrottlingRate(rate);
163 } 175 }
164 176
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { 312 WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
301 WebLocalFrame* web_frame = frame_->GetWebFrame(); 313 WebLocalFrame* web_frame = frame_->GetWebFrame();
302 return web_frame ? web_frame->devToolsAgent() : nullptr; 314 return web_frame ? web_frame->devToolsAgent() : nullptr;
303 } 315 }
304 316
305 bool DevToolsAgent::IsAttached() { 317 bool DevToolsAgent::IsAttached() {
306 return is_attached_; 318 return is_attached_;
307 } 319 }
308 320
309 } // namespace content 321 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698