| Differences between
and this patch
- a/Source/WebCore/ChangeLog +38 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-07-06  Sergey Rogulenko  <rogulenko@google.com>
2
3
        Web Inspector: added Paint events for Images to TimelineAgent
4
        https://bugs.webkit.org/show_bug.cgi?id=90277
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * inspector/InspectorInstrumentation.cpp:
9
        (WebCore::InspectorInstrumentation::willInspectOrphanEventImpl):
10
        (WebCore):
11
        (WebCore::InspectorInstrumentation::didInspectOrphanEventImpl):
12
        * inspector/InspectorInstrumentation.h:
13
        (TimelineEventType):
14
        (WebCore):
15
        (InspectorInstrumentation):
16
        (WebCore::InspectorInstrumentation::willInspectOrphanEvent):
17
        (WebCore::InspectorInstrumentation::didInspectOrphanEvent):
18
        * inspector/InspectorTimelineAgent.cpp:
19
        (TimelineRecordType):
20
        (WebCore::InspectorTimelineAgent::willInspectOrphanEvent):
21
        (WebCore):
22
        (WebCore::InspectorTimelineAgent::didInspectOrphanEvent):
23
        * inspector/InspectorTimelineAgent.h:
24
        (InspectorTimelineAgent):
25
        * inspector/TimelineRecordFactory.cpp:
26
        (WebCore::TimelineRecordFactory::createOrphanEventData):
27
        (WebCore):
28
        * inspector/TimelineRecordFactory.h:
29
        (TimelineRecordFactory):
30
        * inspector/front-end/TimelineModel.js:
31
        * inspector/front-end/TimelinePresentationModel.js:
32
        (WebInspector.TimelinePresentationModel.recordStyle):
33
        (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent):
34
        * platform/graphics/ImageSource.cpp:
35
        (WebCore::ImageSource::createFrameAtIndex):
36
        * platform/graphics/skia/NativeImageSkia.cpp:
37
        (WebCore::NativeImageSkia::resizedBitmap):
38
1
2012-07-05  Arnaud Renevier  <arno@renevier.net>
39
2012-07-05  Arnaud Renevier  <arno@renevier.net>
2
40
3
        [GTK] Showing the context menu in the Web Inspector can crash the browser
41
        [GTK] Showing the context menu in the Web Inspector can crash the browser
- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +12 lines
Lines 473-478 void InspectorInstrumentation::didPaintImpl(const InspectorInstrumentationCookie a/Source/WebCore/inspector/InspectorInstrumentation.cpp_sec1
473
        pageAgent->didPaint();
473
        pageAgent->didPaint();
474
}
474
}
475
475
476
void InspectorInstrumentation::willInspectOrphanEventImpl(const char* event)
477
{
478
    if (InspectorTimelineAgent* timelineAgent = timelineAgentForOrphanEvents())
479
        timelineAgent->willInspectOrphanEvent(event);
480
}
481
482
void InspectorInstrumentation::didInspectOrphanEventImpl(const char* event)
483
{
484
    if (InspectorTimelineAgent* timelineAgent = timelineAgentForOrphanEvents())
485
        timelineAgent->didInspectOrphanEvent(event);
486
}
487
476
void InspectorInstrumentation::willCompositeImpl(InstrumentingAgents* instrumentingAgents)
488
void InspectorInstrumentation::willCompositeImpl(InstrumentingAgents* instrumentingAgents)
477
{
489
{
478
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
490
    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
- a/Source/WebCore/inspector/InspectorInstrumentation.h +36 lines
Lines 40-45 a/Source/WebCore/inspector/InspectorInstrumentation.h_sec1
40
#include "ScriptExecutionContext.h"
40
#include "ScriptExecutionContext.h"
41
#include "StorageArea.h"
41
#include "StorageArea.h"
42
42
43
#if PLATFORM(CHROMIUM)
44
#include "TraceEvent.h"
45
#endif
46
43
#if USE(JSC)
47
#if USE(JSC)
44
namespace JSC {
48
namespace JSC {
45
class ExecState;
49
class ExecState;
Lines 94-99 class WebSocketHandshakeResponse; a/Source/WebCore/inspector/InspectorInstrumentation.h_sec2
94
98
95
typedef pair<InstrumentingAgents*, int> InspectorInstrumentationCookie;
99
typedef pair<InstrumentingAgents*, int> InspectorInstrumentationCookie;
96
100
101
namespace TimelineEventType {
102
static const char DecodeImage[] = "Decode Image";
103
static const char CachedResize[] = "Cached Resize";
104
static const char NonCachedResize[] = "Non-Cached Resize";
105
}
106
97
class InspectorInstrumentation {
107
class InspectorInstrumentation {
98
public:
108
public:
99
    static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
109
    static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
Lines 144-149 public: a/Source/WebCore/inspector/InspectorInstrumentation.h_sec3
144
    static void didLoadXHR(const InspectorInstrumentationCookie&);
154
    static void didLoadXHR(const InspectorInstrumentationCookie&);
145
    static InspectorInstrumentationCookie willPaint(Frame*, GraphicsContext*, const LayoutRect&);
155
    static InspectorInstrumentationCookie willPaint(Frame*, GraphicsContext*, const LayoutRect&);
146
    static void didPaint(const InspectorInstrumentationCookie&);
156
    static void didPaint(const InspectorInstrumentationCookie&);
157
    static void willInspectOrphanEvent(const char*);
158
    static void didInspectOrphanEvent(const char*);
147
    static void willComposite(Page*);
159
    static void willComposite(Page*);
148
    static void didComposite(Page*);
160
    static void didComposite(Page*);
149
    static InspectorInstrumentationCookie willRecalculateStyle(Document*);
161
    static InspectorInstrumentationCookie willRecalculateStyle(Document*);
Lines 313-318 private: a/Source/WebCore/inspector/InspectorInstrumentation.h_sec4
313
    static void didLoadXHRImpl(const InspectorInstrumentationCookie&);
325
    static void didLoadXHRImpl(const InspectorInstrumentationCookie&);
314
    static InspectorInstrumentationCookie willPaintImpl(InstrumentingAgents*, GraphicsContext*, const LayoutRect&, Frame*);
326
    static InspectorInstrumentationCookie willPaintImpl(InstrumentingAgents*, GraphicsContext*, const LayoutRect&, Frame*);
315
    static void didPaintImpl(const InspectorInstrumentationCookie&);
327
    static void didPaintImpl(const InspectorInstrumentationCookie&);
328
    static void willInspectOrphanEventImpl(const char*);
329
    static void didInspectOrphanEventImpl(const char*);
316
    static void willCompositeImpl(InstrumentingAgents*);
330
    static void willCompositeImpl(InstrumentingAgents*);
317
    static void didCompositeImpl(InstrumentingAgents*);
331
    static void didCompositeImpl(InstrumentingAgents*);
318
    static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);
332
    static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);
Lines 835-840 inline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCoo a/Source/WebCore/inspector/InspectorInstrumentation.h_sec5
835
#endif
849
#endif
836
}
850
}
837
851
852
inline void InspectorInstrumentation::willInspectOrphanEvent(const char* event)
853
{
854
#if PLATFORM(CHROMIUM)
855
    TRACE_EVENT_BEGIN0("webkit", event);
856
#endif
857
#if ENABLE(INSPECTOR)
858
    FAST_RETURN_IF_NO_FRONTENDS(void());
859
    willInspectOrphanEventImpl(event);
860
#endif
861
}
862
863
inline void InspectorInstrumentation::didInspectOrphanEvent(const char* event)
864
{
865
#if PLATFORM(CHROMIUM)
866
    TRACE_EVENT_END0("webkit", event);
867
#endif
868
#if ENABLE(INSPECTOR)
869
    FAST_RETURN_IF_NO_FRONTENDS(void());
870
    didInspectOrphanEventImpl(event);
871
#endif
872
}
873
838
inline void InspectorInstrumentation::willComposite(Page* page)
874
inline void InspectorInstrumentation::willComposite(Page* page)
839
{
875
{
840
#if ENABLE(INSPECTOR)
876
#if ENABLE(INSPECTOR)
- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp +11 lines
Lines 66-71 static const char BeginFrame[] = "BeginFrame"; a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec1
66
static const char Layout[] = "Layout";
66
static const char Layout[] = "Layout";
67
static const char RecalculateStyles[] = "RecalculateStyles";
67
static const char RecalculateStyles[] = "RecalculateStyles";
68
static const char Paint[] = "Paint";
68
static const char Paint[] = "Paint";
69
static const char OrphanEvent[] = "OrphanEvent";
69
static const char CompositeLayers[] = "CompositeLayers";
70
static const char CompositeLayers[] = "CompositeLayers";
70
71
71
static const char ParseHTML[] = "ParseHTML";
72
static const char ParseHTML[] = "ParseHTML";
Lines 253-258 void InspectorTimelineAgent::didPaint() a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec2
253
    didCompleteCurrentRecord(TimelineRecordType::Paint);
254
    didCompleteCurrentRecord(TimelineRecordType::Paint);
254
}
255
}
255
256
257
void InspectorTimelineAgent::willInspectOrphanEvent(const char* event)
258
{
259
    pushCurrentRecord(TimelineRecordFactory::createOrphanEventData(event), TimelineRecordType::OrphanEvent, true, 0);
260
}
261
262
void InspectorTimelineAgent::didInspectOrphanEvent(const char* event)
263
{
264
    didCompleteCurrentRecord(TimelineRecordType::OrphanEvent);
265
}
266
256
void InspectorTimelineAgent::willComposite()
267
void InspectorTimelineAgent::willComposite()
257
{
268
{
258
    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::CompositeLayers, false, 0);
269
    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::CompositeLayers, false, 0);
- a/Source/WebCore/inspector/InspectorTimelineAgent.h +3 lines
Lines 100-105 public: a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec1
100
    void willPaint(const LayoutRect&, Frame*);
100
    void willPaint(const LayoutRect&, Frame*);
101
    void didPaint();
101
    void didPaint();
102
102
103
    void willInspectOrphanEvent(const char*);
104
    void didInspectOrphanEvent(const char*);
105
103
    void willComposite();
106
    void willComposite();
104
    void didComposite();
107
    void didComposite();
105
108
- a/Source/WebCore/inspector/TimelineRecordFactory.cpp +7 lines
Lines 179-184 PassRefPtr<InspectorObject> TimelineRecordFactory::createPaintData(const LayoutR a/Source/WebCore/inspector/TimelineRecordFactory.cpp_sec1
179
    return data.release();
179
    return data.release();
180
}
180
}
181
181
182
PassRefPtr<InspectorObject> TimelineRecordFactory::createOrphanEventData(const String& event)
183
{
184
    RefPtr<InspectorObject> data = InspectorObject::create();
185
    data->setString("event", event);
186
    return data.release();
187
}
188
182
PassRefPtr<InspectorObject> TimelineRecordFactory::createParseHTMLData(unsigned int length, unsigned int startLine)
189
PassRefPtr<InspectorObject> TimelineRecordFactory::createParseHTMLData(unsigned int length, unsigned int startLine)
183
{
190
{
184
    RefPtr<InspectorObject> data = InspectorObject::create();
191
    RefPtr<InspectorObject> data = InspectorObject::create();
- a/Source/WebCore/inspector/TimelineRecordFactory.h +2 lines
Lines 77-82 namespace WebCore { a/Source/WebCore/inspector/TimelineRecordFactory.h_sec1
77
77
78
        static PassRefPtr<InspectorObject> createPaintData(const LayoutRect&);
78
        static PassRefPtr<InspectorObject> createPaintData(const LayoutRect&);
79
79
80
        static PassRefPtr<InspectorObject> createOrphanEventData(const String& event);
81
80
        static PassRefPtr<InspectorObject> createParseHTMLData(unsigned int length, unsigned int startLine);
82
        static PassRefPtr<InspectorObject> createParseHTMLData(unsigned int length, unsigned int startLine);
81
83
82
        static PassRefPtr<InspectorObject> createAnimationFrameData(int callbackId);
84
        static PassRefPtr<InspectorObject> createAnimationFrameData(int callbackId);
- a/Source/WebCore/inspector/front-end/TimelineModel.js +1 lines
Lines 50-55 WebInspector.TimelineModel.RecordType = { a/Source/WebCore/inspector/front-end/TimelineModel.js_sec1
50
    Layout: "Layout",
50
    Layout: "Layout",
51
    RecalculateStyles: "RecalculateStyles",
51
    RecalculateStyles: "RecalculateStyles",
52
    Paint: "Paint",
52
    Paint: "Paint",
53
    OrphanEvent: "OrphanEvent",
53
    CompositeLayers: "CompositeLayers",
54
    CompositeLayers: "CompositeLayers",
54
55
55
    ParseHTML: "ParseHTML",
56
    ParseHTML: "ParseHTML",
- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +4 lines
Lines 73-78 WebInspector.TimelinePresentationModel.recordStyle = function(record) a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js_sec1
73
    recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] };
73
    recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] };
74
    recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: categories["rendering"] };
74
    recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: categories["rendering"] };
75
    recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] };
75
    recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] };
76
    recordStyles[recordTypes.OrphanEvent] = { title: WebInspector.UIString("Paint event"), category: categories["painting"] };
76
    recordStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["painting"] };
77
    recordStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["painting"] };
77
    recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: categories["loading"] };
78
    recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: categories["loading"] };
78
    recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: categories["scripting"] };
79
    recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: categories["scripting"] };
Lines 570-575 WebInspector.TimelinePresentationModel.Record.prototype = { a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js_sec2
570
                contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
571
                contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
571
                contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
572
                contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
572
                break;
573
                break;
574
            case recordTypes.OrphanEvent:
575
                contentHelper._appendTextRow(WebInspector.UIString("Event type"), WebInspector.UIString("%s", this.data["event"]));
576
                break;
573
            case recordTypes.RecalculateStyles: // We don't want to see default details.
577
            case recordTypes.RecalculateStyles: // We don't want to see default details.
574
                break;
578
                break;
575
            case recordTypes.Time:
579
            case recordTypes.Time:
- a/Source/WebCore/platform/graphics/ImageSource.cpp +6 lines
Lines 32-37 a/Source/WebCore/platform/graphics/ImageSource.cpp_sec1
32
#include "ImageDecoder.h"
32
#include "ImageDecoder.h"
33
33
34
#include "ImageOrientation.h"
34
#include "ImageOrientation.h"
35
#include "InspectorInstrumentation.h"
35
#include "NotImplemented.h"
36
#include "NotImplemented.h"
36
37
37
namespace WebCore {
38
namespace WebCore {
Lines 141-148 NativeImagePtr ImageSource::createFrameAtIndex(size_t index) a/Source/WebCore/platform/graphics/ImageSource.cpp_sec2
141
{
142
{
142
    if (!m_decoder)
143
    if (!m_decoder)
143
        return 0;
144
        return 0;
145
    
146
    InspectorInstrumentation::willInspectOrphanEvent(TimelineEventType::DecodeImage);
144
147
145
    ImageFrame* buffer = m_decoder->frameBufferAtIndex(index);
148
    ImageFrame* buffer = m_decoder->frameBufferAtIndex(index);
149
    
150
    InspectorInstrumentation::didInspectOrphanEvent(TimelineEventType::DecodeImage);
151
    
146
    if (!buffer || buffer->status() == ImageFrame::FrameEmpty)
152
    if (!buffer || buffer->status() == ImageFrame::FrameEmpty)
147
        return 0;
153
        return 0;
148
154
- a/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp -6 / +5 lines
Lines 34-39 a/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp_sec1
34
34
35
#include "NativeImageSkia.h"
35
#include "NativeImageSkia.h"
36
#include "GraphicsContext3D.h"
36
#include "GraphicsContext3D.h"
37
#include "InspectorInstrumentation.h"
37
#include "SkiaUtils.h"
38
#include "SkiaUtils.h"
38
39
39
#if PLATFORM(CHROMIUM)
40
#if PLATFORM(CHROMIUM)
Lines 82-99 SkBitmap NativeImageSkia::resizedBitmap(const SkIRect& srcSubset, a/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp_sec2
82
        SkBitmap subset;
83
        SkBitmap subset;
83
        m_image.extractSubset(&subset, srcSubset);
84
        m_image.extractSubset(&subset, srcSubset);
84
        if (!shouldCache) {
85
        if (!shouldCache) {
85
#if PLATFORM(CHROMIUM)
86
            InspectorInstrumentation::willInspectOrphanEvent(TimelineEventType::NonCachedResize);
86
            TRACE_EVENT("nonCachedResize", const_cast<NativeImageSkia*>(this), 0);
87
#endif
88
            // Just resize the visible subset and return it.
87
            // Just resize the visible subset and return it.
89
            SkBitmap resizedImage = skia::ImageOperations::Resize(subset, skia::ImageOperations::RESIZE_LANCZOS3, destWidth, destHeight, destVisibleSubset);
88
            SkBitmap resizedImage = skia::ImageOperations::Resize(subset, skia::ImageOperations::RESIZE_LANCZOS3, destWidth, destHeight, destVisibleSubset);
90
            resizedImage.setImmutable();
89
            resizedImage.setImmutable();
90
            InspectorInstrumentation::didInspectOrphanEvent(TimelineEventType::NonCachedResize);
91
            return resizedImage;
91
            return resizedImage;
92
        } else {
92
        } else {
93
#if PLATFORM(CHROMIUM)
93
            InspectorInstrumentation::willInspectOrphanEvent(TimelineEventType::CachedResize);
94
            TRACE_EVENT("cachedResize", const_cast<NativeImageSkia*>(this), 0);
95
#endif
96
            m_resizedImage = skia::ImageOperations::Resize(subset, skia::ImageOperations::RESIZE_LANCZOS3, destWidth, destHeight);
94
            m_resizedImage = skia::ImageOperations::Resize(subset, skia::ImageOperations::RESIZE_LANCZOS3, destWidth, destHeight);
95
            InspectorInstrumentation::didInspectOrphanEvent(TimelineEventType::CachedResize);
97
        }
96
        }
98
        m_resizedImage.setImmutable();
97
        m_resizedImage.setImmutable();
99
    }
98
    }

Return to Bug 90277