OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 291 } |
292 | 292 |
293 static int domTypeForName(ErrorString* errorString, const String& typeString) | 293 static int domTypeForName(ErrorString* errorString, const String& typeString) |
294 { | 294 { |
295 if (typeString == "subtree-modified") | 295 if (typeString == "subtree-modified") |
296 return SubtreeModified; | 296 return SubtreeModified; |
297 if (typeString == "attribute-modified") | 297 if (typeString == "attribute-modified") |
298 return AttributeModified; | 298 return AttributeModified; |
299 if (typeString == "node-removed") | 299 if (typeString == "node-removed") |
300 return NodeRemoved; | 300 return NodeRemoved; |
301 *errorString = "Unknown DOM breakpoint type: " + typeString; | 301 *errorString = String("Unknown DOM breakpoint type: " + typeString); |
302 return -1; | 302 return -1; |
303 } | 303 } |
304 | 304 |
305 static String domTypeName(int type) | 305 static String domTypeName(int type) |
306 { | 306 { |
307 switch (type) { | 307 switch (type) { |
308 case SubtreeModified: return "subtree-modified"; | 308 case SubtreeModified: return "subtree-modified"; |
309 case AttributeModified: return "attribute-modified"; | 309 case AttributeModified: return "attribute-modified"; |
310 case NodeRemoved: return "node-removed"; | 310 case NodeRemoved: return "node-removed"; |
311 default: break; | 311 default: break; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 else | 348 else |
349 m_domBreakpoints.remove(node); | 349 m_domBreakpoints.remove(node); |
350 | 350 |
351 if ((rootBit & inheritableDOMBreakpointTypesMask) && !(mask & (rootBit << do
mBreakpointDerivedTypeShift))) { | 351 if ((rootBit & inheritableDOMBreakpointTypesMask) && !(mask & (rootBit << do
mBreakpointDerivedTypeShift))) { |
352 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; chil
d = InspectorDOMAgent::innerNextSibling(child)) | 352 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; chil
d = InspectorDOMAgent::innerNextSibling(child)) |
353 updateSubtreeBreakpoints(child, rootBit, false); | 353 updateSubtreeBreakpoints(child, rootBit, false); |
354 } | 354 } |
355 didRemoveBreakpoint(); | 355 didRemoveBreakpoint(); |
356 } | 356 } |
357 | 357 |
358 void InspectorDOMDebuggerAgent::getEventListeners(ErrorString* errorString, cons
t String& objectId, OwnPtr<protocol::Array<protocol::DOMDebugger::EventListener>
>* listenersArray) | 358 void InspectorDOMDebuggerAgent::getEventListeners(ErrorString* errorString, cons
t String16& objectId, OwnPtr<protocol::Array<protocol::DOMDebugger::EventListene
r>>* listenersArray) |
359 { | 359 { |
360 v8::HandleScope handles(m_isolate); | 360 v8::HandleScope handles(m_isolate); |
361 | 361 |
362 v8::Local<v8::Context> context; | 362 v8::Local<v8::Context> context; |
363 String objectGroup; | 363 String16 objectGroup; |
364 v8::Local<v8::Value> value = m_runtimeAgent->findObject(objectId, &context,
&objectGroup); | 364 v8::Local<v8::Value> value = m_runtimeAgent->findObject(objectId, &context,
&objectGroup); |
365 if (value.IsEmpty()) { | 365 if (value.IsEmpty()) { |
366 *errorString = "No object with passed objectId"; | 366 *errorString = "No object with passed objectId"; |
367 return; | 367 return; |
368 } | 368 } |
369 v8::Context::Scope scope(context); | 369 v8::Context::Scope scope(context); |
370 *listenersArray = protocol::Array<protocol::DOMDebugger::EventListener>::cre
ate(); | 370 *listenersArray = protocol::Array<protocol::DOMDebugger::EventListener>::cre
ate(); |
371 eventListeners(context, value, objectGroup, listenersArray->get()); | 371 eventListeners(context, value, objectGroup, listenersArray->get()); |
372 } | 372 } |
373 | 373 |
374 void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v
8::Local<v8::Value> object, const String& objectGroup, protocol::Array<protocol:
:DOMDebugger::EventListener>* listenersArray) | 374 void InspectorDOMDebuggerAgent::eventListeners(v8::Local<v8::Context> context, v
8::Local<v8::Value> object, const String16& objectGroup, protocol::Array<protoco
l::DOMDebugger::EventListener>* listenersArray) |
375 { | 375 { |
376 V8EventListenerInfoMap eventInformation; | 376 V8EventListenerInfoMap eventInformation; |
377 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate()
, object, eventInformation); | 377 InspectorDOMDebuggerAgent::eventListenersInfoForTarget(context->GetIsolate()
, object, eventInformation); |
378 for (const auto& it : eventInformation) { | 378 for (const auto& it : eventInformation) { |
379 for (const auto& it2 : *it.second) { | 379 for (const auto& it2 : *it.second) { |
380 if (!it2.useCapture) | 380 if (!it2.useCapture) |
381 continue; | 381 continue; |
382 OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildO
bjectForEventListener(context, it2, objectGroup); | 382 OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildO
bjectForEventListener(context, it2, objectGroup); |
383 if (listenerObject) | 383 if (listenerObject) |
384 listenersArray->addItem(listenerObject.release()); | 384 listenersArray->addItem(listenerObject.release()); |
385 } | 385 } |
386 for (auto& it2 : *it.second) { | 386 for (auto& it2 : *it.second) { |
387 if (it2.useCapture) | 387 if (it2.useCapture) |
388 continue; | 388 continue; |
389 OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildO
bjectForEventListener(context, it2, objectGroup); | 389 OwnPtr<protocol::DOMDebugger::EventListener> listenerObject = buildO
bjectForEventListener(context, it2, objectGroup); |
390 if (listenerObject) | 390 if (listenerObject) |
391 listenersArray->addItem(listenerObject.release()); | 391 listenersArray->addItem(listenerObject.release()); |
392 } | 392 } |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 PassOwnPtr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent::buil
dObjectForEventListener(v8::Local<v8::Context> context, const V8EventListenerInf
o& info, const String& objectGroupId) | 396 PassOwnPtr<protocol::DOMDebugger::EventListener> InspectorDOMDebuggerAgent::buil
dObjectForEventListener(v8::Local<v8::Context> context, const V8EventListenerInf
o& info, const String16& objectGroupId) |
397 { | 397 { |
398 if (info.handler.IsEmpty()) | 398 if (info.handler.IsEmpty()) |
399 return nullptr; | 399 return nullptr; |
400 | 400 |
401 v8::Isolate* isolate = context->GetIsolate(); | 401 v8::Isolate* isolate = context->GetIsolate(); |
402 v8::Local<v8::Function> function = eventListenerEffectiveFunction(isolate, i
nfo.handler); | 402 v8::Local<v8::Function> function = eventListenerEffectiveFunction(isolate, i
nfo.handler); |
403 if (function.IsEmpty()) | 403 if (function.IsEmpty()) |
404 return nullptr; | 404 return nullptr; |
405 | 405 |
406 String scriptId; | 406 String scriptId; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr); | 709 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr); |
710 } | 710 } |
711 } | 711 } |
712 | 712 |
713 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) | 713 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) |
714 { | 714 { |
715 m_domBreakpoints.clear(); | 715 m_domBreakpoints.clear(); |
716 } | 716 } |
717 | 717 |
718 } // namespace blink | 718 } // namespace blink |
OLD | NEW |