| 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 19 matching lines...) Expand all Loading... |
| 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/LocalDOMWindow.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/ConsoleMessage.h" |
| 40 #include "core/inspector/IdentifiersFactory.h" | 41 #include "core/inspector/IdentifiersFactory.h" |
| 41 #include "core/inspector/InspectorClient.h" | 42 #include "core/inspector/InspectorClient.h" |
| 42 #include "core/inspector/InspectorCounters.h" | 43 #include "core/inspector/InspectorCounters.h" |
| 43 #include "core/inspector/InspectorInstrumentation.h" | 44 #include "core/inspector/InspectorInstrumentation.h" |
| 44 #include "core/inspector/InspectorLayerTreeAgent.h" | 45 #include "core/inspector/InspectorLayerTreeAgent.h" |
| 45 #include "core/inspector/InspectorNodeIds.h" | 46 #include "core/inspector/InspectorNodeIds.h" |
| 46 #include "core/inspector/InspectorOverlay.h" | 47 #include "core/inspector/InspectorOverlay.h" |
| 47 #include "core/inspector/InspectorPageAgent.h" | 48 #include "core/inspector/InspectorPageAgent.h" |
| 48 #include "core/inspector/InspectorState.h" | 49 #include "core/inspector/InspectorState.h" |
| 49 #include "core/inspector/InstrumentingAgents.h" | 50 #include "core/inspector/InstrumentingAgents.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 m_threadStates.clear(); | 409 m_threadStates.clear(); |
| 409 m_gpuTask.clear(); | 410 m_gpuTask.clear(); |
| 410 m_layerToNodeMap.clear(); | 411 m_layerToNodeMap.clear(); |
| 411 m_pixelRefToImageInfo.clear(); | 412 m_pixelRefToImageInfo.clear(); |
| 412 m_imageBeingPainted = 0; | 413 m_imageBeingPainted = 0; |
| 413 m_paintSetupStart = 0; | 414 m_paintSetupStart = 0; |
| 414 m_mayEmitFirstPaint = false; | 415 m_mayEmitFirstPaint = false; |
| 415 | 416 |
| 416 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) { | 417 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) { |
| 417 String message = String::format("Timeline '%s' terminated.", m_consoleTi
melines[i].utf8().data()); | 418 String message = String::format("Timeline '%s' terminated.", m_consoleTi
melines[i].utf8().data()); |
| 418 mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageL
evel, message); | 419 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessa
geSource, DebugMessageLevel, message)); |
| 419 } | 420 } |
| 420 m_consoleTimelines.clear(); | 421 m_consoleTimelines.clear(); |
| 421 | 422 |
| 422 m_frontend->stopped(&fromConsole); | 423 m_frontend->stopped(&fromConsole); |
| 423 if (m_overlay) | 424 if (m_overlay) |
| 424 m_overlay->finishedRecordingProfile(); | 425 m_overlay->finishedRecordingProfile(); |
| 425 } | 426 } |
| 426 | 427 |
| 427 void InspectorTimelineAgent::didBeginFrame(int frameId) | 428 void InspectorTimelineAgent::didBeginFrame(int frameId) |
| 428 { | 429 { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 // Only complete console.time that is balanced. | 772 // Only complete console.time that is balanced. |
| 772 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime); | 773 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime); |
| 773 } | 774 } |
| 774 | 775 |
| 775 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St
ring& title, ScriptState* scriptState) | 776 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St
ring& title, ScriptState* scriptState) |
| 776 { | 777 { |
| 777 if (!m_state->getBoolean(TimelineAgentState::enabled)) | 778 if (!m_state->getBoolean(TimelineAgentState::enabled)) |
| 778 return; | 779 return; |
| 779 | 780 |
| 780 String message = String::format("Timeline '%s' started.", title.utf8().data(
)); | 781 String message = String::format("Timeline '%s' started.", title.utf8().data(
)); |
| 781 mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageLevel
, message, String(), 0, 0, nullptr, scriptState); | 782 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessageSo
urce, DebugMessageLevel, message, scriptState)); |
| 782 m_consoleTimelines.append(title); | 783 m_consoleTimelines.append(title); |
| 783 if (!isStarted()) { | 784 if (!isStarted()) { |
| 784 innerStart(); | 785 innerStart(); |
| 785 bool fromConsole = true; | 786 bool fromConsole = true; |
| 786 m_frontend->started(&fromConsole); | 787 m_frontend->started(&fromConsole); |
| 787 } | 788 } |
| 788 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe
cordType::TimeStamp, true, frameForExecutionContext(context)); | 789 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe
cordType::TimeStamp, true, frameForExecutionContext(context)); |
| 789 } | 790 } |
| 790 | 791 |
| 791 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const
String& title, ScriptState* scriptState) | 792 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const
String& title, ScriptState* scriptState) |
| 792 { | 793 { |
| 793 if (!m_state->getBoolean(TimelineAgentState::enabled)) | 794 if (!m_state->getBoolean(TimelineAgentState::enabled)) |
| 794 return; | 795 return; |
| 795 | 796 |
| 796 size_t index = m_consoleTimelines.find(title); | 797 size_t index = m_consoleTimelines.find(title); |
| 797 if (index == kNotFound) { | 798 if (index == kNotFound) { |
| 798 String message = String::format("Timeline '%s' was not started.", title.
utf8().data()); | 799 String message = String::format("Timeline '%s' was not started.", title.
utf8().data()); |
| 799 mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageL
evel, message, String(), 0, 0, nullptr, scriptState); | 800 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessa
geSource, DebugMessageLevel, message, scriptState)); |
| 800 return; | 801 return; |
| 801 } | 802 } |
| 802 | 803 |
| 803 String message = String::format("Timeline '%s' finished.", title.utf8().data
()); | 804 String message = String::format("Timeline '%s' finished.", title.utf8().data
()); |
| 804 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe
cordType::TimeStamp, true, frameForExecutionContext(context)); | 805 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe
cordType::TimeStamp, true, frameForExecutionContext(context)); |
| 805 m_consoleTimelines.remove(index); | 806 m_consoleTimelines.remove(index); |
| 806 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli
neAgentState::startedFromProtocol)) { | 807 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli
neAgentState::startedFromProtocol)) { |
| 807 unwindRecordStack(); | 808 unwindRecordStack(); |
| 808 innerStop(true); | 809 innerStop(true); |
| 809 } | 810 } |
| 810 mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageLevel
, message, String(), 0, 0, nullptr, scriptState); | 811 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessageSo
urce, DebugMessageLevel, message, scriptState)); |
| 811 } | 812 } |
| 812 | 813 |
| 813 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame) | 814 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame) |
| 814 { | 815 { |
| 815 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame(
)); | 816 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame(
)); |
| 816 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec
ordType::MarkDOMContent, false, frame); | 817 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec
ordType::MarkDOMContent, false, frame); |
| 817 if (isMainFrame) | 818 if (isMainFrame) |
| 818 m_mayEmitFirstPaint = true; | 819 m_mayEmitFirstPaint = true; |
| 819 } | 820 } |
| 820 | 821 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 | 1306 |
| 1306 #ifndef NDEBUG | 1307 #ifndef NDEBUG |
| 1307 bool TimelineRecordStack::isOpenRecordOfType(const String& type) | 1308 bool TimelineRecordStack::isOpenRecordOfType(const String& type) |
| 1308 { | 1309 { |
| 1309 return !m_stack.isEmpty() && m_stack.last().type == type; | 1310 return !m_stack.isEmpty() && m_stack.last().type == type; |
| 1310 } | 1311 } |
| 1311 #endif | 1312 #endif |
| 1312 | 1313 |
| 1313 } // namespace WebCore | 1314 } // namespace WebCore |
| 1314 | 1315 |
| OLD | NEW |