| Differences between
and this patch
- a/Source/WebCore/ChangeLog +50 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-12-27  Andrey Kosyakov  <caseq@chromium.org>
2
3
        Web Inspector: plumb trace events to Timeline agent
4
        https://bugs.webkit.org/show_bug.cgi?id=105796
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        - report trace events to Timeline agent;
9
        - use trace events to instrument deferred painting of a layer;
10
        - report other low-level events from within deferred painting (so we get image decode/resize).
11
12
        * inspector/InspectorClient.h:
13
        (WebCore::InspectorClient::enableTraceEventsReporting):
14
        * inspector/InspectorInstrumentation.cpp:
15
        (WebCore):
16
        (WebCore::InspectorInstrumentation::didReportTraceEventImpl):
17
        * inspector/InspectorInstrumentation.h:
18
        (InspectorInstrumentation):
19
        (WebCore::InspectorInstrumentation::didReportTraceEvent):
20
        (WebCore):
21
        * inspector/InspectorTimelineAgent.cpp:
22
        (TimelineRecordType):
23
        (TraceEventArguments):
24
        (WebCore::TraceEventArguments::TraceEventArguments):
25
        (WebCore::TraceEventArguments::size):
26
        (WebCore::TraceEventArguments::getBool):
27
        (WebCore::TraceEventArguments::getInt):
28
        (WebCore::TraceEventArguments::getUInt):
29
        (WebCore::TraceEventArguments::getDouble):
30
        (WebCore::TraceEventArguments::getString):
31
        (WebCore::TraceEventArguments::getParameter):
32
        (WebCore):
33
        (WebCore::InspectorTimelineAgent::start):
34
        (WebCore::InspectorTimelineAgent::stop):
35
        (WebCore::InspectorTimelineAgent::willPaint):
36
        (WebCore::InspectorTimelineAgent::didReportTraceEvent):
37
        (WebCore::InspectorTimelineAgent::onDeferPaint):
38
        (WebCore::InspectorTimelineAgent::onPerformDeferredPaint):
39
        (WebCore::InspectorTimelineAgent::onReleaseLayerId):
40
        (WebCore::InspectorTimelineAgent::addRecordToTimeline):
41
        (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
42
        (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
43
        (WebCore::InspectorTimelineAgent::pushSkippedRecord):
44
        * inspector/InspectorTimelineAgent.h:
45
        (WebCore):
46
        (InspectorTimelineAgent):
47
        * inspector/front-end/TimelineModel.js:
48
        * inspector/front-end/TimelinePresentationModel.js:
49
        (WebInspector.TimelinePresentationModel._initRecordStyles):
50
1
2012-12-26  Yury Semikhatsky  <yurys@chromium.org>
51
2012-12-26  Yury Semikhatsky  <yurys@chromium.org>
2
52
3
        Web Inspector: prepare HeapSnapshot.js for use with native heap snapshot
53
        Web Inspector: prepare HeapSnapshot.js for use with native heap snapshot
- a/Source/WebKit/chromium/ChangeLog +24 lines
Lines 1-3 a/Source/WebKit/chromium/ChangeLog_sec1
1
2012-12-27  Andrey Kosyakov  <caseq@chromium.org>
2
3
        Web Inspector: plumb trace events to Timeline agent
4
        https://bugs.webkit.org/show_bug.cgi?id=105796
5
6
        - plumb trace events to WebCore inspector;
7
        - only report events coming from main thread so far.
8
9
        * public/WebDevToolsAgent.h:
10
        (WebDevToolsAgent):
11
        * public/WebDevToolsAgentClient.h:
12
        (WebKit::WebDevToolsAgentClient::enableTraceEventsReporting):
13
        * src/InspectorClientImpl.cpp:
14
        (WebKit::InspectorClientImpl::enableTraceEventsReporting):
15
        (WebKit):
16
        * src/InspectorClientImpl.h:
17
        (InspectorClientImpl):
18
        * src/WebDevToolsAgentImpl.cpp:
19
        (WebKit::WebDevToolsAgentImpl::enableTraceEventsReporting):
20
        (WebKit):
21
        (WebKit::WebDevToolsAgentImpl::reportTraceEventOnAnyThread):
22
        * src/WebDevToolsAgentImpl.h:
23
        (WebDevToolsAgentImpl):
24
1
2012-12-21  Xianzhu Wang  <wangxianzhu@chromium.org>
25
2012-12-21  Xianzhu Wang  <wangxianzhu@chromium.org>
2
26
3
        [Chromium-Android] Use harfbuzz-ng instead of harfbuzz-old on Android
27
        [Chromium-Android] Use harfbuzz-ng instead of harfbuzz-old on Android
- a/Source/WebCore/inspector/InspectorClient.h +1 lines
Lines 58-63 public: a/Source/WebCore/inspector/InspectorClient.h_sec1
58
    virtual bool canClearBrowserCookies() { return false; }
58
    virtual bool canClearBrowserCookies() { return false; }
59
    virtual void clearBrowserCookies() { }
59
    virtual void clearBrowserCookies() { }
60
    virtual bool canMonitorMainThread() { return false; }
60
    virtual bool canMonitorMainThread() { return false; }
61
    virtual void enableTraceEventsReporting(bool) { }
61
62
62
    virtual bool canOverrideDeviceMetrics() { return false; }
63
    virtual bool canOverrideDeviceMetrics() { return false; }
63
64
- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +11 lines
Lines 322-327 void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumen a/Source/WebCore/inspector/InspectorInstrumentation.cpp_sec1
322
        timelineAgent->didRemoveTimer(timerId, frameForScriptExecutionContext(context));
322
        timelineAgent->didRemoveTimer(timerId, frameForScriptExecutionContext(context));
323
}
323
}
324
324
325
void InspectorInstrumentation::didReportTraceEventImpl(InstrumentingAgents* instrumentingAgents,
326
    char phase, const char* categoryName, const char* name, unsigned long long id,
327
    int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues,
328
    unsigned char flags) 
329
{
330
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
331
        timelineAgent->didReportTraceEvent(static_cast<InspectorTimelineAgent::TraceEventPhase>(phase),
332
            categoryName, name, id, numArguments, argumentNames, argumentTypes, argumentValues, flags);
333
    }
334
}
335
325
InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents* instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context)
336
InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents* instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context)
326
{
337
{
327
    int timelineAgentId = 0;
338
    int timelineAgentId = 0;
- a/Source/WebCore/inspector/InspectorInstrumentation.h +20 lines
Lines 119-124 public: a/Source/WebCore/inspector/InspectorInstrumentation.h_sec1
119
    static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
119
    static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
120
    static void didRemoveTimer(ScriptExecutionContext*, int timerId);
120
    static void didRemoveTimer(ScriptExecutionContext*, int timerId);
121
121
122
    static void didReportTraceEvent(Page*, char phase, const char* categoryName, const char* name, unsigned long long id,
123
        int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues,
124
        unsigned char flags);
125
122
    static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
126
    static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
123
    static void didCallFunction(const InspectorInstrumentationCookie&);
127
    static void didCallFunction(const InspectorInstrumentationCookie&);
124
    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest*);
128
    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest*);
Lines 317-322 private: a/Source/WebCore/inspector/InspectorInstrumentation.h_sec2
317
    static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot, ScriptExecutionContext*);
321
    static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot, ScriptExecutionContext*);
318
    static void didRemoveTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
322
    static void didRemoveTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
319
323
324
    static void didReportTraceEventImpl(InstrumentingAgents*, char phase, const char* categoryName, const char* name, unsigned long long id,
325
        int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues,
326
        unsigned char flags);
327
320
    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine, ScriptExecutionContext*);
328
    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine, ScriptExecutionContext*);
321
    static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
329
    static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
322
    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
330
    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
Lines 782-787 inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* con a/Source/WebCore/inspector/InspectorInstrumentation.h_sec3
782
#endif
790
#endif
783
}
791
}
784
792
793
inline void InspectorInstrumentation::didReportTraceEvent(Page* page,
794
    char phase, const char* categoryName, const char* name, unsigned long long id,
795
    int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues,
796
    unsigned char flags)
797
{
798
#if ENABLE(INSPECTOR)
799
    FAST_RETURN_IF_NO_FRONTENDS(void());
800
    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
801
        didReportTraceEventImpl(instrumentingAgents, phase, categoryName, name, id, numArguments, argumentNames, argumentTypes, argumentValues, flags);
802
#endif
803
}
804
785
inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
805
inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
786
{
806
{
787
#if ENABLE(INSPECTOR)
807
#if ENABLE(INSPECTOR)
- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp -16 / +149 lines
Lines 1-5 a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec1
1
/*
1
/*
2
* Copyright (C) 2009 Google Inc. All rights reserved.
2
* Copyright (C) 2012 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
Lines 73-78 static const char RecalculateStyles[] = "RecalculateStyles"; a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec2
73
static const char InvalidateLayout[] = "InvalidateLayout";
73
static const char InvalidateLayout[] = "InvalidateLayout";
74
static const char Layout[] = "Layout";
74
static const char Layout[] = "Layout";
75
static const char Paint[] = "Paint";
75
static const char Paint[] = "Paint";
76
static const char DeferredPaint[] = "DeferredPaint";
76
static const char ScrollLayer[] = "ScrollLayer";
77
static const char ScrollLayer[] = "ScrollLayer";
77
static const char DecodeImage[] = "DecodeImage";
78
static const char DecodeImage[] = "DecodeImage";
78
static const char ResizeImage[] = "ResizeImage";
79
static const char ResizeImage[] = "ResizeImage";
Lines 110-115 static const char CancelAnimationFrame[] = "CancelAnimationFrame"; a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec3
110
static const char FireAnimationFrame[] = "FireAnimationFrame";
111
static const char FireAnimationFrame[] = "FireAnimationFrame";
111
}
112
}
112
113
114
class TraceEventArguments {
115
public:
116
    TraceEventArguments(int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues)
117
        : m_size(numArguments), m_argumentNames(argumentNames), m_argumentTypes(argumentTypes), m_argumentValues(argumentValues)
118
    {
119
    }
120
121
    int size() const { return m_size; }
122
123
    bool getBool(const char* name) const { return getParameter(name, TRACE_VALUE_TYPE_BOOL).m_bool; }
124
    long long getInt(const char* name) const { return getParameter(name, TRACE_VALUE_TYPE_INT).m_int; }
125
    unsigned long long getUInt(const char* name) const { return getParameter(name, TRACE_VALUE_TYPE_UINT).m_uint; }
126
    double getDouble(const char* name) const { return getParameter(name, TRACE_VALUE_TYPE_DOUBLE).m_double; }
127
    const char* getString(const char* name) const { return getParameter(name, TRACE_VALUE_TYPE_STRING).m_string; }
128
129
private:
130
    // FIXME: use the definition in TraceEvent.h once we expose the latter to all plaforms.
131
    union TraceValueUnion {
132
        bool m_bool;
133
        unsigned long long m_uint;
134
        long long m_int;
135
        double m_double;
136
        const void* m_pointer;
137
        const char* m_string;
138
    };
139
140
    const TraceValueUnion& getParameter(const char* name, char expectedType) const
141
    {
142
        static TraceValueUnion missingValue;
143
144
        for (int i = 0; i < m_size; ++i) {
145
            if (!strcmp(name, m_argumentNames[i])) {
146
                if (m_argumentTypes[i] != expectedType) {
147
                    ASSERT_NOT_REACHED();
148
                    return missingValue;
149
                }
150
                return *reinterpret_cast<const TraceValueUnion*>(m_argumentValues + i);
151
            }
152
        }
153
        ASSERT_NOT_REACHED();
154
        return missingValue;
155
    }
156
157
    int m_size;
158
    const char* const* m_argumentNames;
159
    const unsigned char* m_argumentTypes;
160
    const unsigned long long* m_argumentValues;
161
};
162
163
113
void InspectorTimelineAgent::pushGCEventRecords()
164
void InspectorTimelineAgent::pushGCEventRecords()
114
{
165
{
115
    if (!m_gcEvents.size())
166
    if (!m_gcEvents.size())
Lines 171-176 void InspectorTimelineAgent::start(ErrorString*, const int* maxCallStackDepth) a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec4
171
    m_instrumentingAgents->setInspectorTimelineAgent(this);
222
    m_instrumentingAgents->setInspectorTimelineAgent(this);
172
    ScriptGCEvent::addEventListener(this);
223
    ScriptGCEvent::addEventListener(this);
173
    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
224
    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
225
    if (m_client)
226
        m_client->enableTraceEventsReporting(true);
174
}
227
}
175
228
176
void InspectorTimelineAgent::stop(ErrorString*)
229
void InspectorTimelineAgent::stop(ErrorString*)
Lines 178-183 void InspectorTimelineAgent::stop(ErrorString*) a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec5
178
    if (!m_state->getBoolean(TimelineAgentState::timelineAgentEnabled))
231
    if (!m_state->getBoolean(TimelineAgentState::timelineAgentEnabled))
179
        return;
232
        return;
180
233
234
    if (m_client)
235
        m_client->enableTraceEventsReporting(false);
181
    m_instrumentingAgents->setInspectorTimelineAgent(0);
236
    m_instrumentingAgents->setInspectorTimelineAgent(0);
182
    ScriptGCEvent::removeEventListener(this);
237
    ScriptGCEvent::removeEventListener(this);
183
238
Lines 185-190 void InspectorTimelineAgent::stop(ErrorString*) a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec6
185
    m_gcEvents.clear();
240
    m_gcEvents.clear();
186
241
187
    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, false);
242
    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, false);
243
    m_deferredPaintLayerId = 0;
244
    m_knownLayers.clear();
188
}
245
}
189
246
190
void InspectorTimelineAgent::setIncludeMemoryDetails(ErrorString*, bool value)
247
void InspectorTimelineAgent::setIncludeMemoryDetails(ErrorString*, bool value)
Lines 270-275 void InspectorTimelineAgent::didRecalculateStyle() a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec7
270
327
271
void InspectorTimelineAgent::willPaint(Frame* frame)
328
void InspectorTimelineAgent::willPaint(Frame* frame)
272
{
329
{
330
    if (m_deferredPaintLayerId)
331
        m_knownLayers.add(m_deferredPaintLayerId);
273
    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true, frame, true);
332
    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true, frame, true);
274
}
333
}
275
334
Lines 311-316 void InspectorTimelineAgent::didResizeImage() a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec8
311
    didCompleteCurrentRecord(TimelineRecordType::ResizeImage);
370
    didCompleteCurrentRecord(TimelineRecordType::ResizeImage);
312
}
371
}
313
372
373
374
void InspectorTimelineAgent::didReportTraceEvent(TraceEventPhase phase, const char*, const char* name, unsigned long long id,
375
    int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues,
376
    unsigned char flags)
377
{
378
    TraceEventHandler handler = m_traceEventHandlers.get(name);
379
    if (!handler)
380
        return;
381
    TraceEventArguments arguments(numArgs, argNames, argTypes, argValues);
382
    (this->*handler)(name, phase, arguments);
383
}
384
385
const char kLayerId[] = "layerId";
386
387
void InspectorTimelineAgent::onDeferPaint(const char*, TraceEventPhase phase, const TraceEventArguments& arguments)
388
{
389
    switch (phase) {
390
    case TracePhaseBegin:
391
        m_deferredPaintLayerId = arguments.getUInt(kLayerId);
392
        ASSERT(m_deferredPaintLayerId);
393
        break;
394
    case TracePhaseEnd:
395
        m_deferredPaintLayerId = 0;
396
        break;
397
    default:
398
        ASSERT_NOT_REACHED();
399
    }
400
}
401
402
void InspectorTimelineAgent::onPerformDeferredPaint(const char* name, TraceEventPhase phase, const TraceEventArguments& arguments)
403
{
404
    switch (phase) {
405
    case TracePhaseBegin: {
406
        unsigned long long layerId = arguments.getUInt(kLayerId);
407
        ASSERT(layerId);
408
        if (m_knownLayers.contains(layerId))
409
            pushCurrentRecord(InspectorObject::create(), TimelineRecordType::DeferredPaint, false, 0, true);
410
        else
411
            pushSkippedRecord(TimelineRecordType::DeferredPaint);
412
        break;
413
    }
414
    case TracePhaseEnd:
415
        didCompleteCurrentRecord(TimelineRecordType::DeferredPaint);
416
        break;
417
    default:
418
        ASSERT_NOT_REACHED();
419
    }
420
}
421
422
void InspectorTimelineAgent::onReleaseLayerId(const char*, TraceEventPhase, const TraceEventArguments& arguments)
423
{
424
    unsigned long long id = arguments.getUInt(kLayerId);
425
    ASSERT(id);
426
    m_knownLayers.remove(id);
427
}
428
314
void InspectorTimelineAgent::willComposite()
429
void InspectorTimelineAgent::willComposite()
315
{
430
{
316
    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::CompositeLayers, false, 0);
431
    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::CompositeLayers, false, 0);
Lines 485-490 void InspectorTimelineAgent::didProcessTask() a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec9
485
600
486
void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> record, const String& type, const String& frameId)
601
void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> record, const String& type, const String& frameId)
487
{
602
{
603
    if (!m_recordStack.isEmpty() && !m_recordStack.last().record)
604
        return;
488
    commitFrameRecord();
605
    commitFrameRecord();
489
    innerAddRecordToTimeline(record, type, frameId);
606
    innerAddRecordToTimeline(record, type, frameId);
490
}
607
}
Lines 534-557 void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type) a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec10
534
{
651
{
535
    // An empty stack could merely mean that the timeline agent was turned on in the middle of
652
    // An empty stack could merely mean that the timeline agent was turned on in the middle of
536
    // an event.  Don't treat as an error.
653
    // an event.  Don't treat as an error.
537
    if (!m_recordStack.isEmpty()) {
654
    if (m_recordStack.isEmpty())
538
        if (m_platformInstrumentationClientInstalledAtStackDepth == m_recordStack.size()) {
655
        return;
539
            m_platformInstrumentationClientInstalledAtStackDepth = 0;
540
            PlatformInstrumentation::setClient(0);
541
        }
542
656
543
        pushGCEventRecords();
657
    if (m_platformInstrumentationClientInstalledAtStackDepth == m_recordStack.size()) {
544
        TimelineRecordEntry entry = m_recordStack.last();
658
        m_platformInstrumentationClientInstalledAtStackDepth = 0;
659
        PlatformInstrumentation::setClient(0);
660
    }
661
662
    TimelineRecordEntry entry = m_recordStack.last();
663
    ASSERT(entry.type == type);
664
    if (!entry.record) {
545
        m_recordStack.removeLast();
665
        m_recordStack.removeLast();
546
        ASSERT(entry.type == type);
666
        return;
547
        entry.record->setObject("data", entry.data);
548
        entry.record->setArray("children", entry.children);
549
        entry.record->setNumber("endTime", timestamp());
550
        size_t usedHeapSizeDelta = getUsedHeapSize() - entry.usedHeapSizeAtStart;
551
        if (usedHeapSizeDelta)
552
            entry.record->setNumber("usedHeapSizeDelta", usedHeapSizeDelta);
553
        addRecordToTimeline(entry.record, type, entry.frameId);
554
    }
667
    }
668
669
    pushGCEventRecords();
670
    m_recordStack.removeLast();
671
    entry.record->setObject("data", entry.data);
672
    entry.record->setArray("children", entry.children);
673
    entry.record->setNumber("endTime", timestamp());
674
    size_t usedHeapSizeDelta = getUsedHeapSize() - entry.usedHeapSizeAtStart;
675
    if (usedHeapSizeDelta)
676
        entry.record->setNumber("usedHeapSizeDelta", usedHeapSizeDelta);
677
    addRecordToTimeline(entry.record, type, entry.frameId);
555
}
678
}
556
679
557
InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
680
InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
Lines 564-570 InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentin a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec11
564
    , m_platformInstrumentationClientInstalledAtStackDepth(0)
687
    , m_platformInstrumentationClientInstalledAtStackDepth(0)
565
    , m_inspectorType(type)
688
    , m_inspectorType(type)
566
    , m_client(client)
689
    , m_client(client)
690
    , m_deferredPaintLayerId(0)
567
{
691
{
692
    m_traceEventHandlers.set("Instrumentation::DeferPaint", &InspectorTimelineAgent::onDeferPaint);
693
    m_traceEventHandlers.set("Instrumentation::PerformDeferredPaint", &InspectorTimelineAgent::onPerformDeferredPaint);
694
    m_traceEventHandlers.set("Instrumentation::ReleaseLayerId", &InspectorTimelineAgent::onReleaseLayerId);
695
    
568
}
696
}
569
697
570
void InspectorTimelineAgent::appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame* frame)
698
void InspectorTimelineAgent::appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame* frame)
Lines 594-599 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec12
594
    }
722
    }
595
}
723
}
596
724
725
void InspectorTimelineAgent::pushSkippedRecord(const String& type)
726
{
727
    m_recordStack.append(TimelineRecordEntry(PassRefPtr<InspectorObject>(), PassRefPtr<InspectorObject>(), PassRefPtr<InspectorArray>(), type, "", 0));
728
}
729
597
void InspectorTimelineAgent::commitFrameRecord()
730
void InspectorTimelineAgent::commitFrameRecord()
598
{
731
{
599
    if (!m_pendingFrameRecord)
732
    if (!m_pendingFrameRecord)
- a/Source/WebCore/inspector/InspectorTimelineAgent.h +25 lines
Lines 40-45 a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec1
40
#include "PlatformInstrumentation.h"
40
#include "PlatformInstrumentation.h"
41
#include "ScriptGCEvent.h"
41
#include "ScriptGCEvent.h"
42
#include "ScriptGCEventListener.h"
42
#include "ScriptGCEventListener.h"
43
#include <wtf/HashSet.h>
43
#include <wtf/PassOwnPtr.h>
44
#include <wtf/PassOwnPtr.h>
44
#include <wtf/Vector.h>
45
#include <wtf/Vector.h>
45
46
Lines 55-60 class IntRect; a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec2
55
class RenderObject;
56
class RenderObject;
56
class ResourceRequest;
57
class ResourceRequest;
57
class ResourceResponse;
58
class ResourceResponse;
59
class TraceEventArguments;
58
60
59
typedef String ErrorString;
61
typedef String ErrorString;
60
62
Lines 67-72 class InspectorTimelineAgent a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec3
67
public:
69
public:
68
    enum InspectorType { PageInspector, WorkerInspector };
70
    enum InspectorType { PageInspector, WorkerInspector };
69
71
72
    // FIXME: re-use definitions in TraceEvent.h once it's promoted to all platforms.
73
    enum TraceEventPhase {
74
        TracePhaseBegin = 'B',
75
        TracePhaseEnd = 'E',
76
        TracePhaseInstant = 'I'
77
    };
78
70
    static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
79
    static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state, InspectorType type, InspectorClient* client)
71
    {
80
    {
72
        return adoptPtr(new InspectorTimelineAgent(instrumentingAgents, pageAgent, state, type, client));
81
        return adoptPtr(new InspectorTimelineAgent(instrumentingAgents, pageAgent, state, type, client));
Lines 165-170 public: a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec4
165
    virtual void willResizeImage(bool shouldCache) OVERRIDE;
174
    virtual void willResizeImage(bool shouldCache) OVERRIDE;
166
    virtual void didResizeImage() OVERRIDE;
175
    virtual void didResizeImage() OVERRIDE;
167
176
177
    void didReportTraceEvent(TraceEventPhase, const char* category_name, const char* name, unsigned long long id,
178
        int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues,
179
        unsigned char flags);
180
    
168
private:
181
private:
169
    struct TimelineRecordEntry {
182
    struct TimelineRecordEntry {
170
        TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, size_t usedHeapSizeAtStart)
183
        TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, size_t usedHeapSizeAtStart)
Lines 179-187 private: a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec5
179
        size_t usedHeapSizeAtStart;
192
        size_t usedHeapSizeAtStart;
180
    };
193
    };
181
        
194
        
195
    typedef void (InspectorTimelineAgent::*TraceEventHandler)(const char* name, TraceEventPhase, const TraceEventArguments&);
196
182
    InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorCompositeState*, InspectorType, InspectorClient*);
197
    InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorCompositeState*, InspectorType, InspectorClient*);
183
198
184
    void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*, bool hasLowLevelDetails = false);
199
    void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*, bool hasLowLevelDetails = false);
200
    void pushSkippedRecord(const String& type);
201
185
    void setHeapSizeStatistics(InspectorObject* record);
202
    void setHeapSizeStatistics(InspectorObject* record);
186
203
187
    void didCompleteCurrentRecord(const String& type);
204
    void didCompleteCurrentRecord(const String& type);
Lines 196-201 private: a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec6
196
    double timestamp();
213
    double timestamp();
197
    double timestampFromMicroseconds(double microseconds);
214
    double timestampFromMicroseconds(double microseconds);
198
215
216
    void onDeferPaint(const char* name, TraceEventPhase, const TraceEventArguments&);
217
    void onPerformDeferredPaint(const char* name, TraceEventPhase, const TraceEventArguments&);
218
    void onReleaseLayerId(const char* name, TraceEventPhase, const TraceEventArguments&);
219
199
    InspectorPageAgent* m_pageAgent;
220
    InspectorPageAgent* m_pageAgent;
200
221
201
    InspectorFrontend::Timeline* m_frontend;
222
    InspectorFrontend::Timeline* m_frontend;
Lines 220-225 private: a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec7
220
    RefPtr<InspectorObject> m_pendingFrameRecord;
241
    RefPtr<InspectorObject> m_pendingFrameRecord;
221
    InspectorType m_inspectorType;
242
    InspectorType m_inspectorType;
222
    InspectorClient* m_client;
243
    InspectorClient* m_client;
244
    
245
    HashMap<String, TraceEventHandler> m_traceEventHandlers;
246
    HashSet<unsigned long long> m_knownLayers;
247
    unsigned long long m_deferredPaintLayerId;
223
};
248
};
224
249
225
} // namespace WebCore
250
} // namespace WebCore
- a/Source/WebCore/inspector/front-end/TimelineModel.js +1 lines
Lines 56-61 WebInspector.TimelineModel.RecordType = { a/Source/WebCore/inspector/front-end/TimelineModel.js_sec1
56
    InvalidateLayout: "InvalidateLayout",
56
    InvalidateLayout: "InvalidateLayout",
57
    Layout: "Layout",
57
    Layout: "Layout",
58
    Paint: "Paint",
58
    Paint: "Paint",
59
    DeferredPaint: "DeferredPaint",
59
    ScrollLayer: "ScrollLayer",
60
    ScrollLayer: "ScrollLayer",
60
    DecodeImage: "DecodeImage",
61
    DecodeImage: "DecodeImage",
61
    ResizeImage: "ResizeImage",
62
    ResizeImage: "ResizeImage",
- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +1 lines
Lines 76-81 WebInspector.TimelinePresentationModel._initRecordStyles = function() a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js_sec1
76
    recordStyles[recordTypes.InvalidateLayout] = { title: WebInspector.UIString("Invalidate Layout"), category: categories["rendering"] };
76
    recordStyles[recordTypes.InvalidateLayout] = { title: WebInspector.UIString("Invalidate Layout"), category: categories["rendering"] };
77
    recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] };
77
    recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] };
78
    recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] };
78
    recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] };
79
    recordStyles[recordTypes.DeferredPaint] = { title: WebInspector.UIString("DeferredPaint"), category: categories["painting"] };
79
    recordStyles[recordTypes.ScrollLayer] = { title: WebInspector.UIString("Scroll"), category: categories["painting"] };
80
    recordStyles[recordTypes.ScrollLayer] = { title: WebInspector.UIString("Scroll"), category: categories["painting"] };
80
    recordStyles[recordTypes.DecodeImage] = { title: WebInspector.UIString("Image Decode"), category: categories["painting"] };
81
    recordStyles[recordTypes.DecodeImage] = { title: WebInspector.UIString("Image Decode"), category: categories["painting"] };
81
    recordStyles[recordTypes.ResizeImage] = { title: WebInspector.UIString("Image Resize"), category: categories["painting"] };
82
    recordStyles[recordTypes.ResizeImage] = { title: WebInspector.UIString("Image Resize"), category: categories["painting"] };
- a/Source/WebKit/chromium/public/WebDevToolsAgent.h +3 lines
Lines 71-76 public: a/Source/WebKit/chromium/public/WebDevToolsAgent.h_sec1
71
71
72
    virtual void inspectElementAt(const WebPoint&) = 0;
72
    virtual void inspectElementAt(const WebPoint&) = 0;
73
    virtual void setProcessId(long) = 0;
73
    virtual void setProcessId(long) = 0;
74
    virtual void reportTraceEventOnAnyThread(char phase, const char* categoryName, const char* name, unsigned long long id,
75
        int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues,
76
        unsigned char flags) = 0;
74
77
75
    // Exposed for TestRunner.
78
    // Exposed for TestRunner.
76
    virtual void evaluateInWebInspector(long callId, const WebString& script) = 0;
79
    virtual void evaluateInWebInspector(long callId, const WebString& script) = 0;
- a/Source/WebKit/chromium/public/WebDevToolsAgentClient.h +1 lines
Lines 76-81 public: a/Source/WebKit/chromium/public/WebDevToolsAgentClient.h_sec1
76
        virtual ~InstrumentedObjectSizeProvider() { }
76
        virtual ~InstrumentedObjectSizeProvider() { }
77
    };
77
    };
78
    virtual void dumpUncountedAllocatedObjects(const InstrumentedObjectSizeProvider*) { }
78
    virtual void dumpUncountedAllocatedObjects(const InstrumentedObjectSizeProvider*) { }
79
    virtual void enableTraceEventsReporting(bool enable) { }
79
80
80
protected:
81
protected:
81
    ~WebDevToolsAgentClient() { }
82
    ~WebDevToolsAgentClient() { }
- a/Source/WebKit/chromium/src/InspectorClientImpl.cpp +6 lines
Lines 196-201 bool InspectorClientImpl::captureScreenshot(String* data) a/Source/WebKit/chromium/src/InspectorClientImpl.cpp_sec1
196
    return false;
196
    return false;
197
}
197
}
198
198
199
void InspectorClientImpl::enableTraceEventsReporting(bool enable)
200
{
201
    if (WebDevToolsAgentImpl* agent = devToolsAgent())
202
        agent->enableTraceEventsReporting(enable);
203
}
204
199
WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent()
205
WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent()
200
{
206
{
201
    return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent());
207
    return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent());
- a/Source/WebKit/chromium/src/InspectorClientImpl.h +1 lines
Lines 85-90 public: a/Source/WebKit/chromium/src/InspectorClientImpl.h_sec1
85
    virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
85
    virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
86
86
87
    virtual bool captureScreenshot(WTF::String* data);
87
    virtual bool captureScreenshot(WTF::String* data);
88
    virtual void enableTraceEventsReporting(bool);
88
89
89
private:
90
private:
90
    WebDevToolsAgentImpl* devToolsAgent();
91
    WebDevToolsAgentImpl* devToolsAgent();
- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +16 lines
Lines 39-44 a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec1
39
#include "InspectorBackendDispatcher.h"
39
#include "InspectorBackendDispatcher.h"
40
#include "InspectorController.h"
40
#include "InspectorController.h"
41
#include "InspectorFrontend.h"
41
#include "InspectorFrontend.h"
42
#include "InspectorInstrumentation.h"
42
#include "InspectorProtocolVersion.h"
43
#include "InspectorProtocolVersion.h"
43
#include "InspectorValues.h"
44
#include "InspectorValues.h"
44
#include "MemoryCache.h"
45
#include "MemoryCache.h"
Lines 580-585 bool WebDevToolsAgentImpl::captureScreenshot(WTF::String* data) a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec2
580
    return true;
581
    return true;
581
}
582
}
582
583
584
void WebDevToolsAgentImpl::enableTraceEventsReporting(bool enable)
585
{
586
    m_client->enableTraceEventsReporting(enable);
587
}
588
583
void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message)
589
void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message)
584
{
590
{
585
    inspectorController()->dispatchMessageFromFrontend(message);
591
    inspectorController()->dispatchMessageFromFrontend(message);
Lines 700-705 void WebDevToolsAgentImpl::setProcessId(long processId) a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec3
700
    inspectorController()->setProcessId(processId);
706
    inspectorController()->setProcessId(processId);
701
}
707
}
702
708
709
void WebDevToolsAgentImpl::reportTraceEventOnAnyThread(char phase, const char* categoryName, const char* name, unsigned long long id,
710
    int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues,
711
    unsigned char flags)
712
{
713
    if (!isMainThread())
714
        return;
715
    if (Page* page = m_webViewImpl->page())
716
        InspectorInstrumentation::didReportTraceEvent(page, phase, categoryName, name, id, numArguments, argumentNames, argumentTypes, argumentValues, flags);
717
}
718
703
void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script)
719
void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script)
704
{
720
{
705
    InspectorController* ic = inspectorController();
721
    InspectorController* ic = inspectorController();
- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h +4 lines
Lines 88-93 public: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec1
88
    virtual void inspectElementAt(const WebPoint& point);
88
    virtual void inspectElementAt(const WebPoint& point);
89
    virtual void evaluateInWebInspector(long callId, const WebString& script);
89
    virtual void evaluateInWebInspector(long callId, const WebString& script);
90
    virtual void setProcessId(long);
90
    virtual void setProcessId(long);
91
    virtual void reportTraceEventOnAnyThread(char phase, const char* categoryName, const char* name, unsigned long long id,
92
        int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues,
93
        unsigned char flags);
91
94
92
    // InspectorClient implementation.
95
    // InspectorClient implementation.
93
    virtual void inspectorDestroyed();
96
    virtual void inspectorDestroyed();
Lines 109-114 public: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec2
109
112
110
    virtual void getAllocatedObjects(HashSet<const void*>&);
113
    virtual void getAllocatedObjects(HashSet<const void*>&);
111
    virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
114
    virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
115
    virtual void enableTraceEventsReporting(bool);
112
116
113
    virtual bool captureScreenshot(WTF::String* data);
117
    virtual bool captureScreenshot(WTF::String* data);
114
118

Return to Bug 105796