OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/inspector/InspectorTimelineAgent.h" | 32 #include "core/inspector/InspectorTimelineAgent.h" |
33 | 33 |
34 #include "core/events/Event.h" | 34 #include "core/events/Event.h" |
35 #include "core/frame/DOMWindow.h" | 35 #include "core/frame/LocalDOMWindow.h" |
36 #include "core/frame/FrameConsole.h" | 36 #include "core/frame/FrameConsole.h" |
37 #include "core/frame/FrameHost.h" | 37 #include "core/frame/FrameHost.h" |
38 #include "core/frame/FrameView.h" | 38 #include "core/frame/FrameView.h" |
39 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
40 #include "core/inspector/IdentifiersFactory.h" | 40 #include "core/inspector/IdentifiersFactory.h" |
41 #include "core/inspector/InspectorClient.h" | 41 #include "core/inspector/InspectorClient.h" |
42 #include "core/inspector/InspectorCounters.h" | 42 #include "core/inspector/InspectorCounters.h" |
43 #include "core/inspector/InspectorInstrumentation.h" | 43 #include "core/inspector/InspectorInstrumentation.h" |
44 #include "core/inspector/InspectorLayerTreeAgent.h" | 44 #include "core/inspector/InspectorLayerTreeAgent.h" |
45 #include "core/inspector/InspectorNodeIds.h" | 45 #include "core/inspector/InspectorNodeIds.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 }; | 219 }; |
220 | 220 |
221 static LocalFrame* frameForExecutionContext(ExecutionContext* context) | 221 static LocalFrame* frameForExecutionContext(ExecutionContext* context) |
222 { | 222 { |
223 LocalFrame* frame = 0; | 223 LocalFrame* frame = 0; |
224 if (context->isDocument()) | 224 if (context->isDocument()) |
225 frame = toDocument(context)->frame(); | 225 frame = toDocument(context)->frame(); |
226 return frame; | 226 return frame; |
227 } | 227 } |
228 | 228 |
229 static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window,
Node* node, const EventPath& eventPath) | 229 static bool eventHasListeners(const AtomicString& eventType, LocalDOMWindow* win
dow, Node* node, const EventPath& eventPath) |
230 { | 230 { |
231 if (window && window->hasEventListeners(eventType)) | 231 if (window && window->hasEventListeners(eventType)) |
232 return true; | 232 return true; |
233 | 233 |
234 if (node->hasEventListeners(eventType)) | 234 if (node->hasEventListeners(eventType)) |
235 return true; | 235 return true; |
236 | 236 |
237 for (size_t i = 0; i < eventPath.size(); i++) { | 237 for (size_t i = 0; i < eventPath.size(); i++) { |
238 if (eventPath[i].node()->hasEventListeners(eventType)) | 238 if (eventPath[i].node()->hasEventListeners(eventType)) |
239 return true; | 239 return true; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 { | 439 { |
440 pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptId, sc
riptName, scriptLine), TimelineRecordType::FunctionCall, true, frameForExecution
Context(context)); | 440 pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptId, sc
riptName, scriptLine), TimelineRecordType::FunctionCall, true, frameForExecution
Context(context)); |
441 return true; | 441 return true; |
442 } | 442 } |
443 | 443 |
444 void InspectorTimelineAgent::didCallFunction() | 444 void InspectorTimelineAgent::didCallFunction() |
445 { | 445 { |
446 didCompleteCurrentRecord(TimelineRecordType::FunctionCall); | 446 didCompleteCurrentRecord(TimelineRecordType::FunctionCall); |
447 } | 447 } |
448 | 448 |
449 bool InspectorTimelineAgent::willDispatchEvent(Document* document, const Event&
event, DOMWindow* window, Node* node, const EventPath& eventPath) | 449 bool InspectorTimelineAgent::willDispatchEvent(Document* document, const Event&
event, LocalDOMWindow* window, Node* node, const EventPath& eventPath) |
450 { | 450 { |
451 if (!eventHasListeners(event.type(), window, node, eventPath)) | 451 if (!eventHasListeners(event.type(), window, node, eventPath)) |
452 return false; | 452 return false; |
453 | 453 |
454 pushCurrentRecord(TimelineRecordFactory::createEventDispatchData(event), Tim
elineRecordType::EventDispatch, false, document->frame()); | 454 pushCurrentRecord(TimelineRecordFactory::createEventDispatchData(event), Tim
elineRecordType::EventDispatch, false, document->frame()); |
455 return true; | 455 return true; |
456 } | 456 } |
457 | 457 |
458 bool InspectorTimelineAgent::willDispatchEventOnWindow(const Event& event, DOMWi
ndow* window) | 458 bool InspectorTimelineAgent::willDispatchEventOnWindow(const Event& event, Local
DOMWindow* window) |
459 { | 459 { |
460 if (!window->hasEventListeners(event.type())) | 460 if (!window->hasEventListeners(event.type())) |
461 return false; | 461 return false; |
462 pushCurrentRecord(TimelineRecordFactory::createEventDispatchData(event), Tim
elineRecordType::EventDispatch, false, window->frame()); | 462 pushCurrentRecord(TimelineRecordFactory::createEventDispatchData(event), Tim
elineRecordType::EventDispatch, false, window->frame()); |
463 return true; | 463 return true; |
464 } | 464 } |
465 | 465 |
466 void InspectorTimelineAgent::didDispatchEvent() | 466 void InspectorTimelineAgent::didDispatchEvent() |
467 { | 467 { |
468 didCompleteCurrentRecord(TimelineRecordType::EventDispatch); | 468 didCompleteCurrentRecord(TimelineRecordType::EventDispatch); |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 | 1305 |
1306 #ifndef NDEBUG | 1306 #ifndef NDEBUG |
1307 bool TimelineRecordStack::isOpenRecordOfType(const String& type) | 1307 bool TimelineRecordStack::isOpenRecordOfType(const String& type) |
1308 { | 1308 { |
1309 return !m_stack.isEmpty() && m_stack.last().type == type; | 1309 return !m_stack.isEmpty() && m_stack.last().type == type; |
1310 } | 1310 } |
1311 #endif | 1311 #endif |
1312 | 1312 |
1313 } // namespace WebCore | 1313 } // namespace WebCore |
1314 | 1314 |
OLD | NEW |