| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 const blink::WebDeviceEmulationParams& params) { | 247 const blink::WebDeviceEmulationParams& params) { |
| 248 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); | 248 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); |
| 249 impl->EnableScreenMetricsEmulation(params); | 249 impl->EnableScreenMetricsEmulation(params); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void DevToolsAgent::disableDeviceEmulation() { | 252 void DevToolsAgent::disableDeviceEmulation() { |
| 253 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); | 253 RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view()); |
| 254 impl->DisableScreenMetricsEmulation(); | 254 impl->DisableScreenMetricsEmulation(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 #if defined(USE_TCMALLOC) && !defined(OS_WIN) | |
| 258 static void AllocationVisitor(void* data, const void* ptr) { | |
| 259 typedef blink::WebDevToolsAgentClient::AllocatedObjectVisitor Visitor; | |
| 260 Visitor* visitor = reinterpret_cast<Visitor*>(data); | |
| 261 visitor->visitObject(ptr); | |
| 262 } | |
| 263 #endif | |
| 264 | |
| 265 void DevToolsAgent::visitAllocatedObjects(AllocatedObjectVisitor* visitor) { | |
| 266 #if defined(USE_TCMALLOC) && !defined(OS_WIN) | |
| 267 IterateAllocatedObjects(&AllocationVisitor, visitor); | |
| 268 #endif | |
| 269 } | |
| 270 | |
| 271 // static | 257 // static |
| 272 DevToolsAgent* DevToolsAgent::FromRoutingId(int routing_id) { | 258 DevToolsAgent* DevToolsAgent::FromRoutingId(int routing_id) { |
| 273 IdToAgentMap::iterator it = g_agent_for_routing_id.Get().find(routing_id); | 259 IdToAgentMap::iterator it = g_agent_for_routing_id.Get().find(routing_id); |
| 274 if (it != g_agent_for_routing_id.Get().end()) { | 260 if (it != g_agent_for_routing_id.Get().end()) { |
| 275 return it->second; | 261 return it->second; |
| 276 } | 262 } |
| 277 return NULL; | 263 return NULL; |
| 278 } | 264 } |
| 279 | 265 |
| 280 void DevToolsAgent::OnAttach(const std::string& host_id) { | 266 void DevToolsAgent::OnAttach(const std::string& host_id) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 if (!web_view) | 354 if (!web_view) |
| 369 return NULL; | 355 return NULL; |
| 370 return web_view->devToolsAgent(); | 356 return web_view->devToolsAgent(); |
| 371 } | 357 } |
| 372 | 358 |
| 373 bool DevToolsAgent::IsAttached() { | 359 bool DevToolsAgent::IsAttached() { |
| 374 return is_attached_; | 360 return is_attached_; |
| 375 } | 361 } |
| 376 | 362 |
| 377 } // namespace content | 363 } // namespace content |
| OLD | NEW |