Chromium Code Reviews| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 m_threadStates.clear(); | 406 m_threadStates.clear(); |
| 406 m_gpuTask.clear(); | 407 m_gpuTask.clear(); |
| 407 m_layerToNodeMap.clear(); | 408 m_layerToNodeMap.clear(); |
| 408 m_pixelRefToImageInfo.clear(); | 409 m_pixelRefToImageInfo.clear(); |
| 409 m_imageBeingPainted = 0; | 410 m_imageBeingPainted = 0; |
| 410 m_paintSetupStart = 0; | 411 m_paintSetupStart = 0; |
| 411 m_mayEmitFirstPaint = false; | 412 m_mayEmitFirstPaint = false; |
| 412 | 413 |
| 413 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) { | 414 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) { |
| 414 String message = String::format("Timeline '%s' terminated.", m_consoleTi melines[i].utf8().data()); | 415 String message = String::format("Timeline '%s' terminated.", m_consoleTi melines[i].utf8().data()); |
| 415 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, me ssage); | 416 mainFrame()->console().addMessage(ConsoleMessage::create(JSMessageSource , DebugMessageLevel, message)); |
| 416 } | 417 } |
| 417 m_consoleTimelines.clear(); | 418 m_consoleTimelines.clear(); |
| 418 | 419 |
| 419 m_frontend->stopped(&fromConsole, m_bufferedEvents.release()); | 420 m_frontend->stopped(&fromConsole, m_bufferedEvents.release()); |
| 420 if (m_overlay) | 421 if (m_overlay) |
| 421 m_overlay->finishedRecordingProfile(); | 422 m_overlay->finishedRecordingProfile(); |
| 422 } | 423 } |
| 423 | 424 |
| 424 void InspectorTimelineAgent::didBeginFrame(int frameId) | 425 void InspectorTimelineAgent::didBeginFrame(int frameId) |
| 425 { | 426 { |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime); | 770 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime); |
| 770 } | 771 } |
| 771 | 772 |
| 772 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St ring& title, ScriptState* scriptState) | 773 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St ring& title, ScriptState* scriptState) |
| 773 { | 774 { |
| 774 if (!m_state->getBoolean(TimelineAgentState::enabled)) | 775 if (!m_state->getBoolean(TimelineAgentState::enabled)) |
| 775 return; | 776 return; |
| 776 | 777 |
| 777 String message = String::format("Timeline '%s' started.", title.utf8().data( )); | 778 String message = String::format("Timeline '%s' started.", title.utf8().data( )); |
| 778 | 779 |
| 779 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, messag e, String(), 0, 0, nullptr, scriptState); | 780 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSour ce, DebugMessageLevel, message); |
| 781 consoleMessage->setScriptState(scriptState); | |
| 782 mainFrame()->console().addMessage(consoleMessage.release()); | |
| 780 m_consoleTimelines.append(title); | 783 m_consoleTimelines.append(title); |
| 781 if (!isStarted()) { | 784 if (!isStarted()) { |
| 782 innerStart(); | 785 innerStart(); |
| 783 bool fromConsole = true; | 786 bool fromConsole = true; |
| 784 m_frontend->started(&fromConsole); | 787 m_frontend->started(&fromConsole); |
| 785 } | 788 } |
| 786 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); | 789 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); |
| 787 } | 790 } |
| 788 | 791 |
| 789 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState) | 792 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState) |
| 790 { | 793 { |
| 791 if (!m_state->getBoolean(TimelineAgentState::enabled)) | 794 if (!m_state->getBoolean(TimelineAgentState::enabled)) |
| 792 return; | 795 return; |
| 793 | 796 |
| 794 size_t index = m_consoleTimelines.find(title); | 797 size_t index = m_consoleTimelines.find(title); |
| 795 if (index == kNotFound) { | 798 if (index == kNotFound) { |
| 796 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()); |
| 797 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, me ssage, String(), 0, 0, nullptr, scriptState); | 800 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessage Source, DebugMessageLevel, message); |
| 801 consoleMessage->setScriptState(scriptState); | |
| 802 mainFrame()->console().addMessage(consoleMessage.release()); | |
| 798 return; | 803 return; |
| 799 } | 804 } |
| 800 | 805 |
| 801 String message = String::format("Timeline '%s' finished.", title.utf8().data ()); | 806 String message = String::format("Timeline '%s' finished.", title.utf8().data ()); |
| 802 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); | 807 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); |
| 803 m_consoleTimelines.remove(index); | 808 m_consoleTimelines.remove(index); |
| 804 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli neAgentState::startedFromProtocol)) { | 809 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli neAgentState::startedFromProtocol)) { |
| 805 unwindRecordStack(); | 810 unwindRecordStack(); |
| 806 innerStop(true); | 811 innerStop(true); |
| 807 } | 812 } |
| 808 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, messag e, String(), 0, 0, nullptr, scriptState); | 813 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSour ce, DebugMessageLevel, message); |
| 814 consoleMessage->setScriptState(scriptState); | |
|
aandrey
2014/07/24 14:05:52
maybe override ConsoleMessage::create instead of t
kozyatinskiy1
2014/07/25 09:58:23
We discuss this with @vsevik. There are many calls
| |
| 815 mainFrame()->console().addMessage(consoleMessage.release()); | |
| 809 } | 816 } |
| 810 | 817 |
| 811 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame) | 818 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame) |
| 812 { | 819 { |
| 813 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame( )); | 820 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame( )); |
| 814 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec ordType::MarkDOMContent, false, frame); | 821 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec ordType::MarkDOMContent, false, frame); |
| 815 if (isMainFrame) | 822 if (isMainFrame) |
| 816 m_mayEmitFirstPaint = true; | 823 m_mayEmitFirstPaint = true; |
| 817 } | 824 } |
| 818 | 825 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1303 | 1310 |
| 1304 #if ENABLE(ASSERT) | 1311 #if ENABLE(ASSERT) |
| 1305 bool TimelineRecordStack::isOpenRecordOfType(const String& type) | 1312 bool TimelineRecordStack::isOpenRecordOfType(const String& type) |
| 1306 { | 1313 { |
| 1307 return !m_stack.isEmpty() && m_stack.last().type == type; | 1314 return !m_stack.isEmpty() && m_stack.last().type == type; |
| 1308 } | 1315 } |
| 1309 #endif | 1316 #endif |
| 1310 | 1317 |
| 1311 } // namespace blink | 1318 } // namespace blink |
| 1312 | 1319 |
| OLD | NEW |