Source/WebCore/ChangeLog

 12012-07-03 Sergey Rogulenko <rogulenko@google.com>
 2
 3 Web Inspector: added low-level instrumentation support for TimelineAgent
 4 https://bugs.webkit.org/show_bug.cgi?id=90264
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * inspector/InspectorInstrumentation.cpp:
 9 (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl):
 10 (WebCore):
 11 (WebCore::InspectorInstrumentation::timelineAgent):
 12 (WebCore::InspectorInstrumentation::setTimelineAgent):
 13 (WebCore::InspectorInstrumentation::threadSpecificTimelineAgent):
 14 * inspector/InspectorInstrumentation.h:
 15 (InspectorInstrumentation):
 16 * inspector/InspectorTimelineAgent.cpp:
 17 (WebCore::InspectorTimelineAgent::didRecalculateStyle):
 18 (WebCore::InspectorTimelineAgent::willPaint):
 19 (WebCore::InspectorTimelineAgent::willEvaluateScript):
 20 (WebCore::InspectorTimelineAgent::didReceiveResourceData):
 21 (WebCore::InspectorTimelineAgent::setHeapSizeStatistics):
 22 (WebCore):
 23 (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
 24 (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
 25 (WebCore::InspectorTimelineAgent::appendRecord):
 26 * inspector/InspectorTimelineAgent.h:
 27 (InspectorTimelineAgent):
 28
1292012-07-03 Vsevolod Vlasov <vsevik@chromium.org>
230
331 Web Inspector: Introduce Workspace make it UISourceCode provider for ScriptsPanel.

Source/WebCore/inspector/InspectorInstrumentation.cpp

6868#include "WorkerThread.h"
6969#include "XMLHttpRequest.h"
7070#include <wtf/StdLibExtras.h>
 71#include <wtf/ThreadSpecific.h>
7172#include <wtf/text/CString.h>
7273
7374namespace WebCore {

@@void InspectorInstrumentation::didFireAnimationFrameImpl(const InspectorInstrume
11361137 timelineAgent->didFireAnimationFrame();
11371138}
11381139
 1140InspectorTimelineAgent* InspectorInstrumentation::timelineAgent()
 1141{
 1142 return *threadSpecificTimelineAgent();
 1143}
 1144
 1145void InspectorInstrumentation::setTimelineAgent(InspectorTimelineAgent* inspectorTimelineAgent)
 1146{
 1147 *threadSpecificTimelineAgent() = inspectorTimelineAgent;
 1148}
 1149
 1150WTF::ThreadSpecific<InspectorTimelineAgent*>& InspectorInstrumentation::threadSpecificTimelineAgent()
 1151{
 1152 AtomicallyInitializedStatic(WTF::ThreadSpecific<InspectorTimelineAgent*>*, instance = new WTF::ThreadSpecific<InspectorTimelineAgent*>());
 1153 return *instance;
 1154}
 1155
11391156InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
11401157{
11411158 if (!cookie.first)

Source/WebCore/inspector/InspectorInstrumentation.h

@@public:
252252 static bool hasFrontends() { return s_frontendCounter; }
253253 static bool hasFrontendForScriptContext(ScriptExecutionContext*);
254254 static bool collectingHTMLParseErrors(Page*);
 255 static InspectorTimelineAgent* timelineAgent();
 256 static void setTimelineAgent(InspectorTimelineAgent*);
255257#else
256258 static bool hasFrontends() { return false; }
257259 static bool hasFrontendForScriptContext(ScriptExecutionContext*) { return false; }

@@public:
260262
261263private:
262264#if ENABLE(INSPECTOR)
 265 static WTF::ThreadSpecific<InspectorTimelineAgent*>& threadSpecificTimelineAgent();
 266
263267 static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld*);
264268 static bool isDebuggerPausedImpl(InstrumentingAgents*);
265269

Source/WebCore/inspector/InspectorTimelineAgent.cpp

4040#include "InspectorClient.h"
4141#include "InspectorCounters.h"
4242#include "InspectorFrontend.h"
 43#include "InspectorInstrumentation.h"
4344#include "InspectorPageAgent.h"
4445#include "InspectorState.h"
4546#include "InstrumentingAgents.h"

@@void InspectorTimelineAgent::didRecalculateStyle()
246247
247248void InspectorTimelineAgent::willPaint(const LayoutRect& rect, Frame* frame)
248249{
249  pushCurrentRecord(TimelineRecordFactory::createPaintData(rect), TimelineRecordType::Paint, true, frame);
 250 pushCurrentRecord(TimelineRecordFactory::createPaintData(rect), TimelineRecordType::Paint, true, frame, true);
250251}
251252
252253void InspectorTimelineAgent::didPaint()

@@void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumbe
322323{
323324 pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, frame);
324325}
325 
 326
326327void InspectorTimelineAgent::didEvaluateScript()
327328{
328329 didCompleteCurrentRecord(TimelineRecordType::EvaluateScript);

@@void InspectorTimelineAgent::didReceiveResourceData()
360361{
361362 didCompleteCurrentRecord(TimelineRecordType::ResourceReceivedData);
362363}
363 
 364
364365void InspectorTimelineAgent::willReceiveResourceResponse(unsigned long identifier, const ResourceResponse& response, Frame* frame)
365366{
366367 String requestId = IdentifiersFactory::requestId(identifier);

@@void InspectorTimelineAgent::setHeapSizeStatistics(InspectorObject* record)
484485
485486void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type)
486487{
 488 if (m_lowlevelEventsEnabledStackMark && m_lowlevelEventsEnabledStackMark == static_cast<int>(m_recordStack.size())) {
 489 m_lowlevelEventsEnabledStackMark = 0;
 490 InspectorInstrumentation::setTimelineAgent(0);
 491 }
487492 // An empty stack could merely mean that the timeline agent was turned on in the middle of
488493 // an event. Don't treat as an error.
489494 if (!m_recordStack.isEmpty()) {

@@InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentin
505510 , m_timestampOffset(0)
506511 , m_id(1)
507512 , m_maxCallStackDepth(5)
 513 , m_lowlevelEventsEnabledStackMark(0)
508514 , m_inspectorType(type)
509515 , m_client(client)
510516{

@@void InspectorTimelineAgent::appendRecord(PassRefPtr<InspectorObject> data, cons
522528 addRecordToTimeline(record.release(), type, frameId);
523529}
524530
525 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame* frame)
 531void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame* frame, bool hasLowLevelDetails)
526532{
527533 pushGCEventRecords();
528534 commitCancelableRecords();

@@void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data,
531537 if (frame && m_pageAgent)
532538 frameId = m_pageAgent->frameId(frame);
533539 m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorArray::create(), type, frameId));
 540 if (hasLowLevelDetails) {
 541 if (!m_lowlevelEventsEnabledStackMark) {
 542 m_lowlevelEventsEnabledStackMark = m_recordStack.size();
 543 InspectorInstrumentation::setTimelineAgent(this);
 544 }
 545 }
534546}
535547
536548void InspectorTimelineAgent::pushCancelableRecord(PassRefPtr<InspectorObject> data, const String& type, Frame* frame)

Source/WebCore/inspector/InspectorTimelineAgent.h

@@private:
159159 String frameId;
160160 bool cancelable;
161161 };
162 
 162
163163 InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*, InspectorType, InspectorClient*);
164164
165  void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*);
 165 void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*, bool hasLowLevelDetails = false);
166166 void setHeapSizeStatistics(InspectorObject* record);
167167
168168 void didCompleteCurrentRecord(const String& type);

@@private:
199199 typedef Vector<GCEvent> GCEvents;
200200 GCEvents m_gcEvents;
201201 int m_maxCallStackDepth;
 202 int m_lowlevelEventsEnabledStackMark;
202203 InspectorType m_inspectorType;
203204 InspectorClient* m_client;
204205};