Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: Source/core/inspector/InspectorTimelineAgent.cpp

Issue 376213002: DevTools: Make FrameConsole methods accept ConsoleMessage objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scriptFailedToParse
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 "bindings/core/v8/ScriptCallStackFactory.h"
34 #include "core/events/Event.h" 35 #include "core/events/Event.h"
35 #include "core/frame/LocalDOMWindow.h" 36 #include "core/frame/LocalDOMWindow.h"
36 #include "core/frame/FrameConsole.h" 37 #include "core/frame/FrameConsole.h"
37 #include "core/frame/FrameHost.h" 38 #include "core/frame/FrameHost.h"
38 #include "core/frame/FrameView.h" 39 #include "core/frame/FrameView.h"
39 #include "core/frame/LocalFrame.h" 40 #include "core/frame/LocalFrame.h"
41 #include "core/inspector/ConsoleMessage.h"
40 #include "core/inspector/IdentifiersFactory.h" 42 #include "core/inspector/IdentifiersFactory.h"
41 #include "core/inspector/InspectorClient.h" 43 #include "core/inspector/InspectorClient.h"
42 #include "core/inspector/InspectorCounters.h" 44 #include "core/inspector/InspectorCounters.h"
43 #include "core/inspector/InspectorInstrumentation.h" 45 #include "core/inspector/InspectorInstrumentation.h"
44 #include "core/inspector/InspectorLayerTreeAgent.h" 46 #include "core/inspector/InspectorLayerTreeAgent.h"
45 #include "core/inspector/InspectorNodeIds.h" 47 #include "core/inspector/InspectorNodeIds.h"
46 #include "core/inspector/InspectorOverlay.h" 48 #include "core/inspector/InspectorOverlay.h"
47 #include "core/inspector/InspectorPageAgent.h" 49 #include "core/inspector/InspectorPageAgent.h"
48 #include "core/inspector/InspectorState.h" 50 #include "core/inspector/InspectorState.h"
49 #include "core/inspector/InstrumentingAgents.h" 51 #include "core/inspector/InstrumentingAgents.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 m_threadStates.clear(); 410 m_threadStates.clear();
409 m_gpuTask.clear(); 411 m_gpuTask.clear();
410 m_layerToNodeMap.clear(); 412 m_layerToNodeMap.clear();
411 m_pixelRefToImageInfo.clear(); 413 m_pixelRefToImageInfo.clear();
412 m_imageBeingPainted = 0; 414 m_imageBeingPainted = 0;
413 m_paintSetupStart = 0; 415 m_paintSetupStart = 0;
414 m_mayEmitFirstPaint = false; 416 m_mayEmitFirstPaint = false;
415 417
416 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) { 418 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) {
417 String message = String::format("Timeline '%s' terminated.", m_consoleTi melines[i].utf8().data()); 419 String message = String::format("Timeline '%s' terminated.", m_consoleTi melines[i].utf8().data());
418 mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageL evel, message); 420 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessa geSource, DebugMessageLevel, message));
419 } 421 }
420 m_consoleTimelines.clear(); 422 m_consoleTimelines.clear();
421 423
422 m_frontend->stopped(&fromConsole); 424 m_frontend->stopped(&fromConsole);
423 if (m_overlay) 425 if (m_overlay)
424 m_overlay->finishedRecordingProfile(); 426 m_overlay->finishedRecordingProfile();
425 } 427 }
426 428
427 void InspectorTimelineAgent::didBeginFrame(int frameId) 429 void InspectorTimelineAgent::didBeginFrame(int frameId)
428 { 430 {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 // Only complete console.time that is balanced. 773 // Only complete console.time that is balanced.
772 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime); 774 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime);
773 } 775 }
774 776
775 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St ring& title, ScriptState* scriptState) 777 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St ring& title, ScriptState* scriptState)
776 { 778 {
777 if (!m_state->getBoolean(TimelineAgentState::enabled)) 779 if (!m_state->getBoolean(TimelineAgentState::enabled))
778 return; 780 return;
779 781
780 String message = String::format("Timeline '%s' started.", title.utf8().data( )); 782 String message = String::format("Timeline '%s' started.", title.utf8().data( ));
781 mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageLevel , message, String(), 0, 0, nullptr, scriptState); 783 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessageSo urce, DebugMessageLevel, message, createScriptCallStackForConsole(scriptState))) ;
782 m_consoleTimelines.append(title); 784 m_consoleTimelines.append(title);
783 if (!isStarted()) { 785 if (!isStarted()) {
784 innerStart(); 786 innerStart();
785 bool fromConsole = true; 787 bool fromConsole = true;
786 m_frontend->started(&fromConsole); 788 m_frontend->started(&fromConsole);
787 } 789 }
788 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); 790 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context));
789 } 791 }
790 792
791 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState) 793 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState)
792 { 794 {
793 if (!m_state->getBoolean(TimelineAgentState::enabled)) 795 if (!m_state->getBoolean(TimelineAgentState::enabled))
794 return; 796 return;
795 797
796 size_t index = m_consoleTimelines.find(title); 798 size_t index = m_consoleTimelines.find(title);
797 if (index == kNotFound) { 799 if (index == kNotFound) {
798 String message = String::format("Timeline '%s' was not started.", title. utf8().data()); 800 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); 801 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessa geSource, DebugMessageLevel, message, createScriptCallStackForConsole(scriptStat e)));
800 return; 802 return;
801 } 803 }
802 804
803 String message = String::format("Timeline '%s' finished.", title.utf8().data ()); 805 String message = String::format("Timeline '%s' finished.", title.utf8().data ());
804 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); 806 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context));
805 m_consoleTimelines.remove(index); 807 m_consoleTimelines.remove(index);
806 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli neAgentState::startedFromProtocol)) { 808 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli neAgentState::startedFromProtocol)) {
807 unwindRecordStack(); 809 unwindRecordStack();
808 innerStop(true); 810 innerStop(true);
809 } 811 }
810 mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageLevel , message, String(), 0, 0, nullptr, scriptState); 812 mainFrame()->console().addMessage(ConsoleMessage::create(ConsoleAPIMessageSo urce, DebugMessageLevel, message, createScriptCallStackForConsole(scriptState))) ;
811 } 813 }
812 814
813 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame) 815 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame)
814 { 816 {
815 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame( )); 817 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame( ));
816 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec ordType::MarkDOMContent, false, frame); 818 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec ordType::MarkDOMContent, false, frame);
817 if (isMainFrame) 819 if (isMainFrame)
818 m_mayEmitFirstPaint = true; 820 m_mayEmitFirstPaint = true;
819 } 821 }
820 822
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 1307
1306 #ifndef NDEBUG 1308 #ifndef NDEBUG
1307 bool TimelineRecordStack::isOpenRecordOfType(const String& type) 1309 bool TimelineRecordStack::isOpenRecordOfType(const String& type)
1308 { 1310 {
1309 return !m_stack.isEmpty() && m_stack.last().type == type; 1311 return !m_stack.isEmpty() && m_stack.last().type == type;
1310 } 1312 }
1311 #endif 1313 #endif
1312 1314
1313 } // namespace WebCore 1315 } // namespace WebCore
1314 1316
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698