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

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, 4 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 19 matching lines...) Expand all
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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 m_threadStates.clear(); 454 m_threadStates.clear();
454 m_gpuTask.clear(); 455 m_gpuTask.clear();
455 m_layerToNodeMap.clear(); 456 m_layerToNodeMap.clear();
456 m_pixelRefToImageInfo.clear(); 457 m_pixelRefToImageInfo.clear();
457 m_imageBeingPainted = 0; 458 m_imageBeingPainted = 0;
458 m_paintSetupStart = 0; 459 m_paintSetupStart = 0;
459 m_mayEmitFirstPaint = false; 460 m_mayEmitFirstPaint = false;
460 461
461 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) { 462 for (size_t i = 0; i < m_consoleTimelines.size(); ++i) {
462 String message = String::format("Timeline '%s' terminated.", m_consoleTi melines[i].utf8().data()); 463 String message = String::format("Timeline '%s' terminated.", m_consoleTi melines[i].utf8().data());
463 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, me ssage); 464 mainFrame()->console().addMessage(ConsoleMessage::create(JSMessageSource , DebugMessageLevel, message));
464 } 465 }
465 m_consoleTimelines.clear(); 466 m_consoleTimelines.clear();
466 467
467 m_frontend->stopped(&fromConsole, m_bufferedEvents.release()); 468 m_frontend->stopped(&fromConsole, m_bufferedEvents.release());
468 if (m_overlay) 469 if (m_overlay)
469 m_overlay->finishedRecordingProfile(); 470 m_overlay->finishedRecordingProfile();
470 } 471 }
471 472
472 void InspectorTimelineAgent::didBeginFrame(int frameId) 473 void InspectorTimelineAgent::didBeginFrame(int frameId)
473 { 474 {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime); 818 didCompleteCurrentRecord(TimelineRecordType::ConsoleTime);
818 } 819 }
819 820
820 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St ring& title, ScriptState* scriptState) 821 void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St ring& title, ScriptState* scriptState)
821 { 822 {
822 if (!m_state->getBoolean(TimelineAgentState::enabled)) 823 if (!m_state->getBoolean(TimelineAgentState::enabled))
823 return; 824 return;
824 825
825 String message = String::format("Timeline '%s' started.", title.utf8().data( )); 826 String message = String::format("Timeline '%s' started.", title.utf8().data( ));
826 827
827 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, messag e, String(), 0, 0, nullptr, scriptState); 828 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSour ce, DebugMessageLevel, message);
829 consoleMessage->setScriptState(scriptState);
830 mainFrame()->console().addMessage(consoleMessage.release());
828 m_consoleTimelines.append(title); 831 m_consoleTimelines.append(title);
829 if (!isStarted()) { 832 if (!isStarted()) {
830 m_state->setBoolean(TimelineAgentState::bufferEvents, true); 833 m_state->setBoolean(TimelineAgentState::bufferEvents, true);
831 m_bufferedEvents = TypeBuilder::Array<TimelineEvent>::create(); 834 m_bufferedEvents = TypeBuilder::Array<TimelineEvent>::create();
832 835
833 innerStart(); 836 innerStart();
834 bool fromConsole = true; 837 bool fromConsole = true;
835 m_frontend->started(&fromConsole); 838 m_frontend->started(&fromConsole);
836 } 839 }
837 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); 840 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context));
838 } 841 }
839 842
840 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState) 843 void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState)
841 { 844 {
842 if (!m_state->getBoolean(TimelineAgentState::enabled)) 845 if (!m_state->getBoolean(TimelineAgentState::enabled))
843 return; 846 return;
844 847
845 size_t index = m_consoleTimelines.find(title); 848 size_t index = m_consoleTimelines.find(title);
846 if (index == kNotFound) { 849 if (index == kNotFound) {
847 String message = String::format("Timeline '%s' was not started.", title. utf8().data()); 850 String message = String::format("Timeline '%s' was not started.", title. utf8().data());
848 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, me ssage, String(), 0, 0, nullptr, scriptState); 851 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessage Source, DebugMessageLevel, message);
852 consoleMessage->setScriptState(scriptState);
853 mainFrame()->console().addMessage(consoleMessage.release());
849 return; 854 return;
850 } 855 }
851 856
852 String message = String::format("Timeline '%s' finished.", title.utf8().data ()); 857 String message = String::format("Timeline '%s' finished.", title.utf8().data ());
853 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context)); 858 appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRe cordType::TimeStamp, true, frameForExecutionContext(context));
854 m_consoleTimelines.remove(index); 859 m_consoleTimelines.remove(index);
855 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli neAgentState::startedFromProtocol)) { 860 if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(Timeli neAgentState::startedFromProtocol)) {
856 unwindRecordStack(); 861 unwindRecordStack();
857 innerStop(true); 862 innerStop(true);
858 } 863 }
859 mainFrame()->console().addMessage(JSMessageSource, DebugMessageLevel, messag e, String(), 0, 0, nullptr, scriptState); 864 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSour ce, DebugMessageLevel, message);
865 consoleMessage->setScriptState(scriptState);
866 mainFrame()->console().addMessage(consoleMessage.release());
860 } 867 }
861 868
862 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame) 869 void InspectorTimelineAgent::domContentLoadedEventFired(LocalFrame* frame)
863 { 870 {
864 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame( )); 871 bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame( ));
865 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec ordType::MarkDOMContent, false, frame); 872 appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRec ordType::MarkDOMContent, false, frame);
866 if (isMainFrame) 873 if (isMainFrame)
867 m_mayEmitFirstPaint = true; 874 m_mayEmitFirstPaint = true;
868 } 875 }
869 876
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 visitor->trace(m_timelineAgent); 1371 visitor->trace(m_timelineAgent);
1365 } 1372 }
1366 1373
1367 void TimelineThreadState::trace(Visitor* visitor) 1374 void TimelineThreadState::trace(Visitor* visitor)
1368 { 1375 {
1369 visitor->trace(recordStack); 1376 visitor->trace(recordStack);
1370 } 1377 }
1371 1378
1372 } // namespace blink 1379 } // namespace blink
1373 1380
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698