Changeset 171195 in webkit
- Timestamp:
- Jul 17, 2014 2:16:46 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r171192 r171195 1 2014-07-17 Timothy Hatcher <timothy@apple.com> 2 3 Make console.profile record to the Timeline. 4 5 https://bugs.webkit.org/show_bug.cgi?id=134643 6 7 Reviewed by Joseph Pecoraro. 8 9 * fast/profiler/profile-with-no-title-expected.txt: 10 11 * inspector-protocol/profiler/console-profile-expected.txt: Removed. 12 * inspector-protocol/profiler/console-profile.html: Removed. 13 * inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt: Removed. 14 * inspector-protocol/profiler/console-profileEnd-parameterless.html: Removed. 15 Removed because console.profile does not go through the profiler protocol now. 16 1 17 2014-07-16 Roger Fong <roger_fong@apple.com> 2 18 -
trunk/LayoutTests/fast/profiler/profile-with-no-title-expected.txt
r163140 r171195 3 3 To run this test manually, load it in the browser then load the WebInspector and look at the profile. If there is a profile that is sufficient for this test. 4 4 5 Profile title: org.webkit.profiles.user-initiated.15 Profile title: 6 6 Thread_1 (no file) (line 0:0) 7 7 startTest profile-with-no-title.html (line 11:1) -
trunk/Source/WebCore/ChangeLog
r171188 r171195 1 2014-07-17 Timothy Hatcher <timothy@apple.com> 2 3 Make console.profile record to the Timeline. 4 5 https://bugs.webkit.org/show_bug.cgi?id=134643 6 7 Reviewed by Joseph Pecoraro. 8 9 Passes existing profiler tests in fast/profiler. 10 11 * bindings/js/ScriptState.cpp: 12 (WebCore::domWindowFromExecState): 13 (WebCore::frameFromExecState): 14 (WebCore::scriptExecutionContextFromExecState): 15 (WebCore::mainWorldExecState): 16 (WebCore::execStateFromNode): 17 * bindings/js/ScriptState.h: 18 * inspector/InspectorController.cpp: 19 (WebCore::InspectorController::InspectorController): 20 (WebCore::InspectorController::profilerEnabled): 21 (WebCore::InspectorController::setProfilerEnabled): 22 * inspector/InspectorController.h: 23 * inspector/InspectorInstrumentation.cpp: 24 (WebCore::InspectorInstrumentation::startProfilingImpl): 25 (WebCore::InspectorInstrumentation::stopProfilingImpl): 26 * inspector/InspectorTimelineAgent.cpp: 27 (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend): 28 (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend): 29 (WebCore::InspectorTimelineAgent::start): 30 (WebCore::InspectorTimelineAgent::stop): 31 (WebCore::startProfiling): 32 (WebCore::stopProfiling): 33 (WebCore::InspectorTimelineAgent::startFromConsole): 34 (WebCore::InspectorTimelineAgent::stopFromConsole): 35 (WebCore::InspectorTimelineAgent::didWriteHTML): 36 (WebCore::InspectorTimelineAgent::breakpointActionProbe): 37 (WebCore::toProtocol): 38 (WebCore::InspectorTimelineAgent::addRecordToTimeline): 39 (WebCore::InspectorTimelineAgent::didCompleteRecordEntry): 40 (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): 41 (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): 42 (WebCore::InspectorTimelineAgent::sendEvent): 43 (WebCore::InspectorTimelineAgent::createRecordEntry): 44 (WebCore::InspectorTimelineAgent::pushCurrentRecord): 45 * inspector/InspectorTimelineAgent.h: 46 (WebCore::InspectorTimelineAgent::TimelineRecordEntry::TimelineRecordEntry): 47 (WebCore::InspectorTimelineAgent::pushCurrentRecord): 48 * inspector/InstrumentingAgents.cpp: 49 (WebCore::InstrumentingAgents::InstrumentingAgents): 50 (WebCore::InstrumentingAgents::reset): 51 * inspector/InstrumentingAgents.h: 52 (WebCore::InstrumentingAgents::persistentInspectorTimelineAgent): 53 (WebCore::InstrumentingAgents::setPersistentInspectorTimelineAgent): 54 * inspector/TimelineRecordFactory.cpp: 55 (WebCore::TimelineRecordFactory::createConsoleProfileData): 56 * inspector/TimelineRecordFactory.h: 57 * inspector/protocol/Timeline.json: 58 * page/PageConsole.cpp: 59 (WebCore::PageConsole::profileEnd): 60 1 61 2014-07-16 Sam Weinig <sam@webkit.org> 2 62 -
trunk/Source/WebCore/bindings/js/ScriptState.cpp
r159679 r171195 52 52 JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject(); 53 53 if (!globalObject->inherits(JSDOMWindowBase::info())) 54 return 0;54 return nullptr; 55 55 return &JSC::jsCast<JSDOMWindowBase*>(globalObject)->impl(); 56 } 57 58 Frame* frameFromExecState(JSC::ExecState* scriptState) 59 { 60 ScriptExecutionContext* context = scriptExecutionContextFromExecState(scriptState); 61 Document* document = context && context->isDocument() ? toDocument(context) : nullptr; 62 return document ? document->frame() : nullptr; 56 63 } 57 64 … … 60 67 JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject(); 61 68 if (!globalObject->inherits(JSDOMGlobalObject::info())) 62 return 0;69 return nullptr; 63 70 return JSC::jsCast<JSDOMGlobalObject*>(globalObject)->scriptExecutionContext(); 64 71 } … … 67 74 { 68 75 if (!frame) 69 return 0;76 return nullptr; 70 77 JSDOMWindowShell* shell = frame->script().windowShell(mainThreadNormalWorld()); 71 78 return shell->window()->globalExec(); … … 75 82 { 76 83 if (!node) 77 return 0;84 return nullptr; 78 85 Frame* frame = node->document().frame(); 79 86 if (!frame) 80 return 0;87 return nullptr; 81 88 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) 82 return 0;89 return nullptr; 83 90 return frame->script().globalObject(world)->globalExec(); 84 91 } -
trunk/Source/WebCore/bindings/js/ScriptState.h
r160457 r171195 53 53 54 54 DOMWindow* domWindowFromExecState(JSC::ExecState*); 55 Frame* frameFromExecState(JSC::ExecState*); 55 56 ScriptExecutionContext* scriptExecutionContextFromExecState(JSC::ExecState*); 56 57 -
trunk/Source/WebCore/inspector/InspectorController.cpp
r170774 r171195 135 135 136 136 auto timelineAgentPtr = std::make_unique<InspectorTimelineAgent>(m_instrumentingAgents.get(), pageAgent, InspectorTimelineAgent::PageInspector, inspectorClient); 137 InspectorTimelineAgent*timelineAgent = timelineAgentPtr.get();137 m_timelineAgent = timelineAgentPtr.get(); 138 138 m_agents.append(WTF::move(timelineAgentPtr)); 139 139 … … 176 176 177 177 runtimeAgent->setScriptDebugServer(&m_debuggerAgent->scriptDebugServer()); 178 timelineAgent->setPageScriptDebugServer(&m_debuggerAgent->scriptDebugServer());178 m_timelineAgent->setPageScriptDebugServer(&m_debuggerAgent->scriptDebugServer()); 179 179 m_profilerAgent->setScriptDebugServer(&m_debuggerAgent->scriptDebugServer()); 180 180 } … … 381 381 bool InspectorController::profilerEnabled() const 382 382 { 383 return m_ profilerAgent->enabled();383 return m_instrumentingAgents->inspectorTimelineAgent(); 384 384 } 385 385 386 386 void InspectorController::setProfilerEnabled(bool enable) 387 387 { 388 ErrorString error; 389 if (enable) 390 m_profilerAgent->enable(&error); 391 else 392 m_profilerAgent->disable(&error); 388 if (enable) { 389 m_instrumentingAgents->setPersistentInspectorTimelineAgent(m_timelineAgent); 390 m_timelineAgent->start(); 391 } else { 392 m_instrumentingAgents->setPersistentInspectorTimelineAgent(nullptr); 393 m_timelineAgent->stop(); 394 } 393 395 } 394 396 -
trunk/Source/WebCore/inspector/InspectorController.h
r170406 r171195 63 63 class InspectorPageAgent; 64 64 class InspectorResourceAgent; 65 class InspectorTimelineAgent; 65 66 class InstrumentingAgents; 66 67 class Node; … … 145 146 InspectorDOMDebuggerAgent* m_domDebuggerAgent; 146 147 Inspector::InspectorProfilerAgent* m_profilerAgent; 148 InspectorTimelineAgent* m_timelineAgent; 147 149 148 150 RefPtr<Inspector::InspectorBackendDispatcher> m_inspectorBackendDispatcher; -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r168306 r171195 946 946 void InspectorInstrumentation::startProfilingImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* exec, const String& title) 947 947 { 948 if (Inspector ProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())949 profilerAgent->startProfiling(title, exec);948 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->persistentInspectorTimelineAgent()) 949 timelineAgent->startFromConsole(exec, title); 950 950 } 951 951 952 952 PassRefPtr<JSC::Profile> InspectorInstrumentation::stopProfilingImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* exec, const String& title) 953 953 { 954 if (Inspector ProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent())955 return profilerAgent->stopProfiling(title, exec);954 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->persistentInspectorTimelineAgent()) 955 return timelineAgent->stopFromConsole(exec, title); 956 956 return nullptr; 957 957 } -
trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp
r167530 r171195 75 75 m_frontendDispatcher = std::make_unique<InspectorTimelineFrontendDispatcher>(frontendChannel); 76 76 m_backendDispatcher = InspectorTimelineBackendDispatcher::create(backendDispatcher, this); 77 78 m_instrumentingAgents->setPersistentInspectorTimelineAgent(this); 77 79 } 78 80 … … 82 84 m_backendDispatcher.clear(); 83 85 86 m_instrumentingAgents->setPersistentInspectorTimelineAgent(nullptr); 87 84 88 ErrorString error; 85 89 stop(&error); … … 88 92 void InspectorTimelineAgent::start(ErrorString*, const int* maxCallStackDepth) 89 93 { 90 if (!m_frontendDispatcher)91 return;92 93 94 if (maxCallStackDepth && *maxCallStackDepth > 0) 94 95 m_maxCallStackDepth = *maxCallStackDepth; … … 104 105 105 106 m_enabled = true; 107 108 if (m_frontendDispatcher) 109 m_frontendDispatcher->recordingStarted(); 106 110 } 107 111 … … 111 115 return; 112 116 113 m_weakFactory.revokeAll();114 117 m_instrumentingAgents->setInspectorTimelineAgent(nullptr); 115 118 … … 120 123 121 124 m_enabled = false; 125 126 if (m_frontendDispatcher) 127 m_frontendDispatcher->recordingStopped(); 122 128 } 123 129 … … 130 136 } 131 137 138 static inline void startProfiling(JSC::ExecState* exec, const String& title) 139 { 140 JSC::LegacyProfiler::profiler()->startProfiling(exec, title); 141 } 142 143 static inline PassRefPtr<JSC::Profile> stopProfiling(JSC::ExecState* exec, const String& title) 144 { 145 return JSC::LegacyProfiler::profiler()->stopProfiling(exec, title); 146 } 147 132 148 static inline void startProfiling(Frame* frame, const String& title) 133 149 { 134 JSC::LegacyProfiler::profiler()->startProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title);150 startProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title); 135 151 } 136 152 137 153 static inline PassRefPtr<JSC::Profile> stopProfiling(Frame* frame, const String& title) 138 154 { 139 return JSC::LegacyProfiler::profiler()->stopProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title); 155 return stopProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title); 156 } 157 158 void InspectorTimelineAgent::startFromConsole(JSC::ExecState* exec, const String &title) 159 { 160 // Only allow recording of a profile if it is anonymous (empty title) or does not match 161 // the title of an already recording profile. 162 if (!title.isEmpty()) { 163 for (const TimelineRecordEntry& record : m_pendingConsoleProfileRecords) { 164 String recordTitle; 165 record.data->getString(ASCIILiteral("title"), &recordTitle); 166 if (recordTitle == title) 167 return; 168 } 169 } 170 171 if (m_pendingConsoleProfileRecords.isEmpty()) 172 start(); 173 174 startProfiling(exec, title); 175 176 m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec))); 177 } 178 179 PassRefPtr<JSC::Profile> InspectorTimelineAgent::stopFromConsole(JSC::ExecState* exec, const String& title) 180 { 181 // Stop profiles in reverse order. If the title is empty, then stop the last profile. 182 // Otherwise, match the title of the profile to stop. 183 for (ptrdiff_t i = m_pendingConsoleProfileRecords.size() - 1; i >= 0; --i) { 184 const TimelineRecordEntry& record = m_pendingConsoleProfileRecords[i]; 185 186 String recordTitle; 187 record.data->getString(ASCIILiteral("title"), &recordTitle); 188 189 if (title.isEmpty() || recordTitle == title) { 190 RefPtr<JSC::Profile> profile = stopProfiling(exec, title); 191 if (profile) 192 TimelineRecordFactory::appendProfile(record.data.get(), profile); 193 194 didCompleteRecordEntry(record); 195 196 m_pendingConsoleProfileRecords.remove(i); 197 198 if (m_pendingConsoleProfileRecords.isEmpty()) 199 stop(); 200 201 return profile.release(); 202 } 203 } 204 205 return nullptr; 140 206 } 141 207 … … 265 331 { 266 332 if (!m_recordStack.isEmpty()) { 267 TimelineRecordEntryentry = m_recordStack.last();333 const TimelineRecordEntry& entry = m_recordStack.last(); 268 334 entry.data->setNumber("endLine", endLine); 269 335 didCompleteCurrentRecord(TimelineRecordType::ParseHTML); … … 458 524 ASSERT(exec); 459 525 460 ScriptExecutionContext* context = scriptExecutionContextFromExecState(exec); 461 Document* document = (context && context->isDocument()) ? toDocument(context) : nullptr; 462 Frame* frame = document ? document->frame() : nullptr; 463 appendRecord(TimelineRecordFactory::createProbeSampleData(action, hitCount), TimelineRecordType::ProbeSample, false, frame); 526 appendRecord(TimelineRecordFactory::createProbeSampleData(action, hitCount), TimelineRecordType::ProbeSample, false, frameFromExecState(exec)); 464 527 } 465 528 … … 529 592 case TimelineRecordType::ProbeSample: 530 593 return Inspector::TypeBuilder::Timeline::EventType::ProbeSample; 594 case TimelineRecordType::ConsoleProfile: 595 return Inspector::TypeBuilder::Timeline::EventType::ConsoleProfile; 531 596 532 597 case TimelineRecordType::RequestAnimationFrame: … … 559 624 sendEvent(record.release()); 560 625 else { 561 TimelineRecordEntryparent = m_recordStack.last();626 const TimelineRecordEntry& parent = m_recordStack.last(); 562 627 parent.children->pushObject(record.release()); 563 628 } … … 574 639 } 575 640 641 void InspectorTimelineAgent::didCompleteRecordEntry(const TimelineRecordEntry& entry) 642 { 643 entry.record->setObject(ASCIILiteral("data"), entry.data); 644 entry.record->setArray(ASCIILiteral("children"), entry.children); 645 entry.record->setNumber(ASCIILiteral("endTime"), timestamp()); 646 addRecordToTimeline(entry.record, entry.type); 647 } 648 576 649 void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineRecordType type) 577 650 { … … 581 654 TimelineRecordEntry entry = m_recordStack.last(); 582 655 m_recordStack.removeLast(); 583 ASSERT(entry.type == type); 584 entry.record->setObject("data", entry.data); 585 entry.record->setArray("children", entry.children); 586 entry.record->setNumber("endTime", timestamp()); 587 addRecordToTimeline(entry.record, type); 656 ASSERT_UNUSED(type, entry.type == type); 657 didCompleteRecordEntry(entry); 588 658 } 589 659 } … … 597 667 , m_inspectorType(type) 598 668 , m_client(client) 599 , m_weakFactory(this)600 669 , m_enabled(false) 601 670 , m_recordingProfile(false) … … 613 682 void InspectorTimelineAgent::sendEvent(PassRefPtr<InspectorObject> event) 614 683 { 684 if (!m_frontendDispatcher) 685 return; 686 615 687 // FIXME: runtimeCast is a hack. We do it because we can't build TimelineEvent directly now. 616 688 RefPtr<Inspector::TypeBuilder::Timeline::TimelineEvent> recordChecked = Inspector::TypeBuilder::Timeline::TimelineEvent::runtimeCast(event); … … 618 690 } 619 691 620 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, TimelineRecordType type, bool captureCallStack, Frame* frame)692 InspectorTimelineAgent::TimelineRecordEntry InspectorTimelineAgent::createRecordEntry(PassRefPtr<InspectorObject> data, TimelineRecordType type, bool captureCallStack, Frame* frame) 621 693 { 622 694 RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), captureCallStack ? m_maxCallStackDepth : 0); 623 695 setFrameIdentifier(record.get(), frame); 624 m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorArray::create(), type)); 696 return TimelineRecordEntry(record.release(), data, InspectorArray::create(), type); 697 } 698 699 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, TimelineRecordType type, bool captureCallStack, Frame* frame) 700 { 701 pushCurrentRecord(createRecordEntry(data, type, captureCallStack, frame)); 625 702 } 626 703 -
trunk/Source/WebCore/inspector/InspectorTimelineAgent.h
r167811 r171195 44 44 #include <wtf/WeakPtr.h> 45 45 46 namespace JSC { 47 class Profile; 48 } 49 46 50 namespace WebCore { 47 51 … … 98 102 FunctionCall, 99 103 ProbeSample, 104 ConsoleProfile, 100 105 101 106 RequestAnimationFrame, … … 137 142 virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override; 138 143 139 virtual void start(ErrorString* , const int* maxCallStackDepth) override;140 virtual void stop(ErrorString* ) override;144 virtual void start(ErrorString* = nullptr, const int* maxCallStackDepth = nullptr) override; 145 virtual void stop(ErrorString* = nullptr) override; 141 146 142 147 int id() const { return m_id; } … … 147 152 148 153 // Methods called from WebCore. 154 void startFromConsole(JSC::ExecState*, const String &title); 155 PassRefPtr<JSC::Profile> stopFromConsole(JSC::ExecState*, const String& title); 156 149 157 void willCallFunction(const String& scriptName, int scriptLine, Frame*); 150 158 void didCallFunction(Frame*); … … 225 233 226 234 struct TimelineRecordEntry { 235 TimelineRecordEntry() 236 : type(TimelineRecordType::EventDispatch) { } 227 237 TimelineRecordEntry(PassRefPtr<Inspector::InspectorObject> record, PassRefPtr<Inspector::InspectorObject> data, PassRefPtr<Inspector::InspectorArray> children, TimelineRecordType type) 228 238 : record(record), data(data), children(children), type(type) 229 239 { 230 240 } 241 231 242 RefPtr<Inspector::InspectorObject> record; 232 243 RefPtr<Inspector::InspectorObject> data; … … 238 249 void appendRecord(PassRefPtr<Inspector::InspectorObject> data, TimelineRecordType, bool captureCallStack, Frame*); 239 250 void pushCurrentRecord(PassRefPtr<Inspector::InspectorObject>, TimelineRecordType, bool captureCallStack, Frame*); 251 void pushCurrentRecord(const TimelineRecordEntry& record) { m_recordStack.append(record); } 252 253 TimelineRecordEntry createRecordEntry(PassRefPtr<Inspector::InspectorObject> data, TimelineRecordType, bool captureCallStack, Frame*); 240 254 241 255 void setFrameIdentifier(Inspector::InspectorObject* record, Frame*); 242 256 257 void didCompleteRecordEntry(const TimelineRecordEntry&); 243 258 void didCompleteCurrentRecord(TimelineRecordType); 244 259 … … 265 280 InspectorType m_inspectorType; 266 281 InspectorClient* m_client; 267 WeakPtrFactory<InspectorTimelineAgent> m_weakFactory; 282 283 Vector<TimelineRecordEntry> m_pendingConsoleProfileRecords; 268 284 269 285 bool m_enabled; -
trunk/Source/WebCore/inspector/InstrumentingAgents.cpp
r164986 r171195 57 57 , m_workerRuntimeAgent(nullptr) 58 58 , m_inspectorTimelineAgent(nullptr) 59 , m_persistentInspectorTimelineAgent(nullptr) 59 60 , m_inspectorDOMStorageAgent(nullptr) 60 61 #if ENABLE(WEB_REPLAY) … … 85 86 m_workerRuntimeAgent = nullptr; 86 87 m_inspectorTimelineAgent = nullptr; 88 m_persistentInspectorTimelineAgent = nullptr; 87 89 m_inspectorDOMStorageAgent = nullptr; 88 90 #if ENABLE(WEB_REPLAY) -
trunk/Source/WebCore/inspector/InstrumentingAgents.h
r167530 r171195 106 106 void setInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_inspectorTimelineAgent = agent; } 107 107 108 InspectorTimelineAgent* persistentInspectorTimelineAgent() const { return m_persistentInspectorTimelineAgent; } 109 void setPersistentInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_persistentInspectorTimelineAgent = agent; } 110 108 111 InspectorDOMStorageAgent* inspectorDOMStorageAgent() const { return m_inspectorDOMStorageAgent; } 109 112 void setInspectorDOMStorageAgent(InspectorDOMStorageAgent* agent) { m_inspectorDOMStorageAgent = agent; } … … 155 158 WorkerRuntimeAgent* m_workerRuntimeAgent; 156 159 InspectorTimelineAgent* m_inspectorTimelineAgent; 160 InspectorTimelineAgent* m_persistentInspectorTimelineAgent; 157 161 InspectorDOMStorageAgent* m_inspectorDOMStorageAgent; 158 162 #if ENABLE(WEB_REPLAY) -
trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp
r167595 r171195 91 91 } 92 92 93 PassRefPtr<InspectorObject> TimelineRecordFactory::createConsoleProfileData(const String& title) 94 { 95 RefPtr<InspectorObject> data = InspectorObject::create(); 96 data->setString("title", title); 97 return data.release(); 98 } 99 93 100 PassRefPtr<InspectorObject> TimelineRecordFactory::createProbeSampleData(const ScriptBreakpointAction& action, int hitCount) 94 101 { -
trunk/Source/WebCore/inspector/TimelineRecordFactory.h
r167530 r171195 62 62 63 63 static PassRefPtr<Inspector::InspectorObject> createFunctionCallData(const String& scriptName, int scriptLine); 64 static PassRefPtr<Inspector::InspectorObject> createConsoleProfileData(const String& title); 64 65 65 66 static PassRefPtr<Inspector::InspectorObject> createProbeSampleData(const Inspector::ScriptBreakpointAction&, int hitCount); -
trunk/Source/WebCore/inspector/protocol/Timeline.json
r166846 r171195 6 6 "id": "EventType", 7 7 "type": "string", 8 "enum": ["EventDispatch", "ScheduleStyleRecalculation", "RecalculateStyles", "InvalidateLayout", "Layout", "Paint", "ScrollLayer", "ResizeImage", "ParseHTML", "TimerInstall", "TimerRemove", "TimerFire", "EvaluateScript", "MarkLoad", "MarkDOMContent", "TimeStamp", "Time", "TimeEnd", "ScheduleResourceRequest", "ResourceSendRequest", "ResourceReceiveResponse", "ResourceReceivedData", "ResourceFinish", "XHRReadyStateChange", "XHRLoad", "FunctionCall", "ProbeSample", " GCEvent", "RequestAnimationFrame", "CancelAnimationFrame", "FireAnimationFrame", "WebSocketCreate", "WebSocketSendHandshakeRequest", "WebSocketReceiveHandshakeResponse", "WebSocketDestroy"],8 "enum": ["EventDispatch", "ScheduleStyleRecalculation", "RecalculateStyles", "InvalidateLayout", "Layout", "Paint", "ScrollLayer", "ResizeImage", "ParseHTML", "TimerInstall", "TimerRemove", "TimerFire", "EvaluateScript", "MarkLoad", "MarkDOMContent", "TimeStamp", "Time", "TimeEnd", "ScheduleResourceRequest", "ResourceSendRequest", "ResourceReceiveResponse", "ResourceReceivedData", "ResourceFinish", "XHRReadyStateChange", "XHRLoad", "FunctionCall", "ProbeSample", "ConsoleProfile", "GCEvent", "RequestAnimationFrame", "CancelAnimationFrame", "FireAnimationFrame", "WebSocketCreate", "WebSocketSendHandshakeRequest", "WebSocketReceiveHandshakeResponse", "WebSocketDestroy"], 9 9 "description": "Timeline record type." 10 10 }, … … 40 40 ], 41 41 "description": "Fired for every instrumentation event while timeline is started." 42 }, 43 { 44 "name": "recordingStarted", 45 "description": "Fired when recording has started." 46 }, 47 { 48 "name": "recordingStopped", 49 "description": "Fired when recording has stopped." 42 50 } 43 51 ] -
trunk/Source/WebCore/page/PageConsole.cpp
r167530 r171195 171 171 void PageConsole::profileEnd(JSC::ExecState* exec, const String& title) 172 172 { 173 RefPtr<JSC::Profile> profile = InspectorInstrumentation::stopProfiling(&m_page, exec, title); 174 if (profile) 173 if (RefPtr<JSC::Profile> profile = InspectorInstrumentation::stopProfiling(&m_page, exec, title)) 175 174 m_profiles.append(profile.release()); 176 175 } -
trunk/Source/WebInspectorUI/ChangeLog
r171172 r171195 1 2014-07-17 Timothy Hatcher <timothy@apple.com> 2 3 Make console.profile record to the Timeline. 4 5 https://bugs.webkit.org/show_bug.cgi?id=134643 6 7 Reviewed by Joseph Pecoraro. 8 9 * Localizations/en.lproj/localizedStrings.js: 10 * UserInterface/Controllers/TimelineManager.js: 11 (WebInspector.TimelineManager.prototype.startCapturing): 12 (WebInspector.TimelineManager.prototype.stopCapturing): 13 (WebInspector.TimelineManager.prototype.capturingStarted): 14 (WebInspector.TimelineManager.prototype.capturingStopped): 15 (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): 16 (WebInspector.TimelineManager.prototype.eventRecorded): 17 * UserInterface/Images/TimelineRecordConsoleProfile.svg: Added. 18 * UserInterface/Models/ScriptTimelineRecord.js: 19 * UserInterface/Protocol/TimelineObserver.js: 20 (WebInspector.TimelineObserver.prototype.eventRecorded): 21 (WebInspector.TimelineObserver.prototype.recordingStarted): 22 (WebInspector.TimelineObserver.prototype.recordingStopped): 23 * UserInterface/Views/TimelineIcons.css: 24 (.console-profile-record .icon): 25 * UserInterface/Views/TimelineRecordTreeElement.js: 26 (WebInspector.TimelineRecordTreeElement): 27 1 28 2014-07-16 Saam Barati <sbarati@apple.com> 2 29 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r170138 r171195 102 102 localizedStrings["Conditional expression"] = "Conditional expression"; 103 103 localizedStrings["Console"] = "Console"; 104 localizedStrings["Console Profile Recorded"] = "Console Profile Recorded"; 104 105 localizedStrings["Console errors, click to show the Console"] = "Console errors, click to show the Console"; 105 106 localizedStrings["Console logs, click to show the Console"] = "Console logs, click to show the Console"; … … 153 154 localizedStrings["Element establishes a stacking context"] = "Element establishes a stacking context"; 154 155 localizedStrings["Element has CSS blending applied and composited descendants"] = "Element has CSS blending applied and composited descendants"; 155 localizedStrings["Element is a stacking context and has composited descendants with CSS blending applied"] = "Element is a stacking context and has composited descendants with CSS blending applied";156 156 localizedStrings["Element has CSS filters applied"] = "Element has CSS filters applied"; 157 157 localizedStrings["Element has CSS filters applied and composited descendants"] = "Element has CSS filters applied and composited descendants"; … … 172 172 localizedStrings["Element is <video>"] = "Element is <video>"; 173 173 localizedStrings["Element is a plug-in"] = "Element is a plug-in"; 174 localizedStrings["Element is a stacking context and has composited descendants with CSS blending applied"] = "Element is a stacking context and has composited descendants with CSS blending applied"; 174 175 localizedStrings["Element is animated"] = "Element is animated"; 175 176 localizedStrings["Element is masked and composited descendants"] = "Element is masked and composited descendants"; … … 217 218 localizedStrings["HTTP"] = "HTTP"; 218 219 localizedStrings["Height"] = "Height"; 220 localizedStrings["Hide Replay Controls"] = "Hide Replay Controls"; 219 221 localizedStrings["Hide compositing borders"] = "Hide compositing borders"; 220 222 localizedStrings["Hide console (%s)"] = "Hide console (%s)"; 221 localizedStrings["Hide Replay Controls"] = "Hide Replay Controls";222 223 localizedStrings["Hide shadow DOM nodes"] = "Hide shadow DOM nodes"; 223 224 localizedStrings["Hide the %s details sidebar"] = "Hide the %s details sidebar"; … … 345 346 localizedStrings["Reflection"] = "Reflection"; 346 347 localizedStrings["Refresh"] = "Refresh"; 348 localizedStrings["Region Flow"] = "Region Flow"; 347 349 localizedStrings["Region announced in its entirety."] = "Region announced in its entirety."; 348 localizedStrings["Region Flow"] = "Region Flow";349 350 localizedStrings["Reload page (%s)\nReload ignoring cache (%s)"] = "Reload page (%s)\nReload ignoring cache (%s)"; 350 351 localizedStrings["Removals"] = "Removals"; … … 388 389 localizedStrings["Show All"] = "Show All"; 389 390 localizedStrings["Show All Nodes (%d More)"] = "Show All Nodes (%d More)"; 391 localizedStrings["Show Replay Controls"] = "Show Replay Controls"; 390 392 localizedStrings["Show compositing borders"] = "Show compositing borders"; 391 393 localizedStrings["Show console (%s)"] = "Show console (%s)"; 392 394 localizedStrings["Show full-height console"] = "Show full-height console"; 393 395 localizedStrings["Show function definition"] = "Show function definition"; 394 localizedStrings["Show Replay Controls"] = "Show Replay Controls";395 396 localizedStrings["Show shadow DOM nodes"] = "Show shadow DOM nodes"; 396 397 localizedStrings["Show split console"] = "Show split console"; … … 408 409 localizedStrings["Spelling"] = "Spelling"; 409 410 localizedStrings["Start JavaScript profiling."] = "Start JavaScript profiling."; 411 localizedStrings["Start Playback"] = "Start Playback"; 410 412 localizedStrings["Start Recording"] = "Start Recording"; 411 localizedStrings["Start Playback"] = "Start Playback";412 413 localizedStrings["Start Time"] = "Start Time"; 413 414 localizedStrings["Status"] = "Status"; … … 463 464 localizedStrings["originally %s"] = "originally %s"; 464 465 localizedStrings["undefined × %d"] = "undefined × %d"; 466 localizedStrings["“%s” Profile Recorded"] = "“%s” Profile Recorded"; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
r169754 r171195 62 62 startCapturing: function() 63 63 { 64 TimelineAgent.start(); 65 }, 66 67 stopCapturing: function() 68 { 69 TimelineAgent.stop(); 70 }, 71 72 capturingStarted: function() 73 { 64 74 if (this._isCapturing) 65 75 return; … … 67 77 this._isCapturing = true; 68 78 69 TimelineAgent.start();70 71 79 this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStarted); 72 80 }, 73 81 74 stopCapturing: function()82 capturingStopped: function() 75 83 { 76 84 if (!this._isCapturing) … … 86 94 delete this._deadTimeTimeout; 87 95 } 88 89 TimelineAgent.stop();90 96 91 97 this._isCapturing = false; … … 230 236 break; 231 237 238 case TimelineAgent.EventType.ConsoleProfile: 239 var profile = this._profileFromPayload(recordPayload.data.profile); 240 console.assert(profile); 241 this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.title, profile)); 242 break; 243 232 244 case TimelineAgent.EventType.FunctionCall: 233 245 // FunctionCall always happens as a child of another record, and since the FunctionCall record -
trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
r168678 r171195 47 47 AnimationFrameFired: "script-timeline-record-animation-frame-fired", 48 48 AnimationFrameRequested: "script-timeline-record-animation-frame-requested", 49 AnimationFrameCanceled: "script-timeline-record-animation-frame-canceled" 49 AnimationFrameCanceled: "script-timeline-record-animation-frame-canceled", 50 ConsoleProfileRecorded: "script-timeline-record-console-profile-recorded" 50 51 }; 51 52 … … 217 218 case WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded: 218 219 return WebInspector.UIString("Probe Sample Recorded"); 220 case WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded: 221 if (details && (details instanceof String || typeof details === "string")) 222 return WebInspector.UIString("“%s” Profile Recorded").format(details); 223 return WebInspector.UIString("Console Profile Recorded"); 219 224 case WebInspector.ScriptTimelineRecord.EventType.TimerFired: 220 225 if (details && includeTimerIdentifierInMainTitle) -
trunk/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js
r164543 r171195 37 37 { 38 38 WebInspector.timelineManager.eventRecorded(record); 39 }, 40 41 recordingStarted: function() 42 { 43 WebInspector.timelineManager.capturingStarted(); 44 }, 45 46 recordingStopped: function() 47 { 48 WebInspector.timelineManager.capturingStopped(); 39 49 } 40 50 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineIcons.css
r167509 r171195 80 80 } 81 81 82 .console-profile-record .icon { 83 content: url(../Images/TimelineRecordConsoleProfile.svg); 84 } 85 82 86 .timer-record .icon { 83 87 content: url(../Images/TimelineRecordTimer.svg); -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js
r167509 r171195 81 81 iconStyleClass = WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass; 82 82 break; 83 case WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded: 84 iconStyleClass = WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass; 85 break; 83 86 case WebInspector.ScriptTimelineRecord.EventType.TimerFired: 84 87 case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled: … … 117 120 WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass = "animation-record"; 118 121 WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass = "probe-record"; 122 WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass = "console-profile-record"; 119 123 120 124 WebInspector.TimelineRecordTreeElement.prototype = { -
trunk/Source/WebKit/mac/ChangeLog
r171164 r171195 1 2014-07-17 Timothy Hatcher <timothy@apple.com> 2 3 Make console.profile record to the Timeline. 4 5 https://bugs.webkit.org/show_bug.cgi?id=134643 6 7 Reviewed by Joseph Pecoraro. 8 9 * WebInspector/WebInspector.mm: 10 (-[WebInspector isProfilingJavaScript]): 11 (-[WebInspector toggleProfilingJavaScript:]): 12 (-[WebInspector startProfilingJavaScript:]): 13 (-[WebInspector stopProfilingJavaScript:]): 14 (-[WebInspector isJavaScriptProfilingEnabled]): 15 (-[WebInspector setJavaScriptProfilingEnabled:]): 16 1 17 2014-07-16 David Kilzer <ddkilzer@apple.com> 2 18 -
trunk/Source/WebKit/mac/WebInspector/WebInspector.mm
r170710 r171195 110 110 - (BOOL)isProfilingJavaScript 111 111 { 112 return _frontend && [_frontend isProfilingJavaScript]; 112 // No longer supported. 113 return NO; 113 114 } 114 115 115 116 - (void)toggleProfilingJavaScript:(id)sender 116 117 { 117 [self showWindow]; 118 119 if ([self isProfilingJavaScript]) 120 [_frontend stopProfilingJavaScript]; 121 else 122 [_frontend startProfilingJavaScript]; 118 // No longer supported. 123 119 } 124 120 125 121 - (void)startProfilingJavaScript:(id)sender 126 122 { 127 if (_frontend) 128 [_frontend startProfilingJavaScript]; 123 // No longer supported. 129 124 } 130 125 131 126 - (void)stopProfilingJavaScript:(id)sender 132 127 { 133 if (_frontend) 134 [_frontend stopProfilingJavaScript]; 128 // No longer supported. 135 129 } 136 130 137 131 - (BOOL)isJavaScriptProfilingEnabled 138 132 { 139 if (Page* page = core(_webView)) 140 return page->inspectorController().profilerEnabled(); 133 // No longer supported. 141 134 return NO; 142 135 } … … 144 137 - (void)setJavaScriptProfilingEnabled:(BOOL)enabled 145 138 { 146 Page* page = core(_webView); 147 if (!page) 148 return; 149 150 page->inspectorController().setProfilerEnabled(enabled); 139 // No longer supported. 151 140 } 152 141 -
trunk/Source/WebKit2/ChangeLog
r171194 r171195 1 2014-07-17 Timothy Hatcher <timothy@apple.com> 2 3 Make console.profile record to the Timeline. 4 5 https://bugs.webkit.org/show_bug.cgi?id=134643 6 7 Reviewed by Joseph Pecoraro. 8 9 * WebProcess/WebPage/WebInspector.cpp: 10 (WebKit::WebInspector::setJavaScriptProfilingEnabled): 11 (WebKit::WebInspector::startJavaScriptProfiling): 12 (WebKit::WebInspector::stopJavaScriptProfiling): 13 1 14 2014-07-17 Brady Eidson <beidson@apple.com> 2 15 -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
r170774 r171195 278 278 void WebInspector::setJavaScriptProfilingEnabled(bool enabled) 279 279 { 280 m_page->corePage()->inspectorController().show(); 281 if (!m_frontendClient) 282 return; 283 284 m_page->corePage()->inspectorController().setProfilerEnabled(enabled); 280 // No longer supported. 285 281 } 286 282 287 283 void WebInspector::startJavaScriptProfiling() 288 284 { 289 m_page->corePage()->inspectorController().show(); 290 if (m_frontendClient) 291 m_frontendClient->startProfilingJavaScript(); 285 // No longer supported. 292 286 } 293 287 294 288 void WebInspector::stopJavaScriptProfiling() 295 289 { 296 m_page->corePage()->inspectorController().show(); 297 if (m_frontendClient) 298 m_frontendClient->stopProfilingJavaScript(); 290 // No longer supported. 299 291 } 300 292
Note: See TracChangeset
for help on using the changeset viewer.