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/renderer/devtools/devtools_agent.h" | 5 #include "content/renderer/devtools/devtools_agent.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 for (size_t i = 0; i < tasks.size(); i++) { | 217 for (size_t i = 0; i < tasks.size(); i++) { |
218 const GpuTaskInfo& task = tasks[i]; | 218 const GpuTaskInfo& task = tasks[i]; |
219 WebDevToolsAgent::GPUEvent event( | 219 WebDevToolsAgent::GPUEvent event( |
220 task.timestamp, task.phase, task.foreign, task.gpu_memory_used_bytes); | 220 task.timestamp, task.phase, task.foreign, task.gpu_memory_used_bytes); |
221 event.limitGPUMemoryBytes = task.gpu_memory_limit_bytes; | 221 event.limitGPUMemoryBytes = task.gpu_memory_limit_bytes; |
222 web_agent->processGPUEvent(event); | 222 web_agent->processGPUEvent(event); |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 void DevToolsAgent::enableDeviceEmulation( | 226 void DevToolsAgent::enableDeviceEmulation( |
227 const blink::WebRect& device_rect, | |
228 const blink::WebRect& view_rect, | |
229 float device_scale_factor, | |
230 bool fit_to_view) { | |
231 blink::WebDeviceEmulationParams params; | |
232 params.screenPosition = device_rect.isEmpty() ? | |
233 blink::WebDeviceEmulationParams::Desktop : | |
234 blink::WebDeviceEmulationParams::Mobile; | |
235 params.deviceScaleFactor = device_scale_factor; | |
236 params.viewSize = blink::WebSize(view_rect.width, view_rect.height); | |
237 params.fitToView = fit_to_view; | |
238 params.viewInsets = blink::WebSize(device_rect.x, device_rect.y); | |
239 enableDeviceEmulation(params); | |
240 } | |
241 | |
242 void DevToolsAgent::enableDeviceEmulation( | |
243 const blink::WebDeviceEmulationParams& params) { | 227 const blink::WebDeviceEmulationParams& params) { |
244 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); | 228 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); |
245 impl->webview()->settings()->setForceCompositingMode(true); | 229 impl->webview()->settings()->setForceCompositingMode(true); |
246 impl->EnableScreenMetricsEmulation(params); | 230 impl->EnableScreenMetricsEmulation(params); |
247 } | 231 } |
248 | 232 |
249 void DevToolsAgent::disableDeviceEmulation() { | 233 void DevToolsAgent::disableDeviceEmulation() { |
250 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); | 234 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); |
251 impl->DisableScreenMetricsEmulation(); | 235 impl->DisableScreenMetricsEmulation(); |
252 } | 236 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 if (!web_view) | 354 if (!web_view) |
371 return NULL; | 355 return NULL; |
372 return web_view->devToolsAgent(); | 356 return web_view->devToolsAgent(); |
373 } | 357 } |
374 | 358 |
375 bool DevToolsAgent::IsAttached() { | 359 bool DevToolsAgent::IsAttached() { |
376 return is_attached_; | 360 return is_attached_; |
377 } | 361 } |
378 | 362 |
379 } // namespace content | 363 } // namespace content |
OLD | NEW |