| Differences between
and this patch
- a/Source/WebCore/ChangeLog +48 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-12-28  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
        This exposes a callback to embedder to allow feeding of trace events to Timeline agent.
9
        Some events will be specially processed to extract information that will be presented
10
        on timeline.
11
12
        * CMakeLists.txt: Added TimelineTraceEventReporter.{h,cpp}
13
        * GNUmakefile.list.am: ditto.
14
        * Target.pri: ditto.
15
        * WebCore.gypi: ditto.
16
        * WebCore.vcproj/WebCore.vcproj: ditto.
17
        * inspector/InspectorAllInOne.cpp: ditto.
18
        * inspector/InspectorClient.h:
19
        (InspectorClient):
20
        (WebCore::InspectorClient::setTraceEventCallback):
21
        * inspector/InspectorTimelineAgent.cpp:
22
        (WebCore::InspectorTimelineAgent::start): Enable trace events collection on start.
23
        (WebCore::InspectorTimelineAgent::stop): Disable trace events collection on stop.
24
        (WebCore):
25
        (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
26
        * inspector/InspectorTimelineAgent.h:
27
        (WebCore):
28
        (InspectorTimelineAgent):
29
        * inspector/TimelineTraceEventProcessor.cpp: Added.
30
        (TraceEventArguments):
31
        (WebCore::TraceEventArguments::TraceEventArguments): A helper to extract arguments from trace event.
32
        (WebCore::TraceEventArguments::size):
33
        (WebCore::TraceEventArguments::asBool):
34
        (WebCore::TraceEventArguments::asInt):
35
        (WebCore::TraceEventArguments::asUInt):
36
        (WebCore::TraceEventArguments::asDouble):
37
        (WebCore::TraceEventArguments::asString):
38
        (WebCore::TraceEventArguments::parameter):
39
        (WebCore):
40
        (WebCore::TimelineTraceEventProcessor::TimelineTraceEventProcessor):
41
        (WebCore::TimelineTraceEventProcessor::~TimelineTraceEventProcessor):
42
        (WebCore::TimelineTraceEventProcessor::processEvent):
43
        * inspector/TimelineTraceEventProcessor.h: Added.
44
        (WebCore):
45
        (TimelineTraceEventProcessor):
46
        (WebCore::TimelineTraceEventProcessor::EventTypeEntry::EventTypeEntry):
47
        (EventTypeEntry):
48
1
2012-12-28  Ilya Tikhonovsky  <loislo@chromium.org>
49
2012-12-28  Ilya Tikhonovsky  <loislo@chromium.org>
2
50
3
        Web Inspector: Native Memory Instrumentation: instrument not instrumented members.
51
        Web Inspector: Native Memory Instrumentation: instrument not instrumented members.
- a/Source/WebKit/chromium/ChangeLog +24 lines
Lines 1-3 a/Source/WebKit/chromium/ChangeLog_sec1
1
2012-12-28  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
        - Plumb enabling of trace events to embedder
9
          (added setTraceEventCallback to InspectorClient .. WebDevToolsAgentClient)
10
11
        * public/WebDevToolsAgentClient.h:
12
        (WebDevToolsAgentClient):
13
        (WebKit::WebDevToolsAgentClient::setTraceEventCallback):
14
        * src/InspectorClientImpl.cpp:
15
        (WebKit::InspectorClientImpl::setTraceEventCallback):
16
        (WebKit):
17
        * src/InspectorClientImpl.h:
18
        (InspectorClientImpl):
19
        * src/WebDevToolsAgentImpl.cpp:
20
        (WebKit::WebDevToolsAgentImpl::setTraceEventCallback):
21
        (WebKit):
22
        * src/WebDevToolsAgentImpl.h:
23
        (WebDevToolsAgentImpl):
24
1
2012-12-28  Fady Samuel  <fsamuel@chromium.org>
25
2012-12-28  Fady Samuel  <fsamuel@chromium.org>
2
26
3
        Roll Chromium DEPS to r174739
27
        Roll Chromium DEPS to r174739
- a/Source/WebCore/CMakeLists.txt +1 lines
Lines 1633-1638 set(WebCore_SOURCES a/Source/WebCore/CMakeLists.txt_sec1
1633
    inspector/ScriptCallFrame.cpp
1633
    inspector/ScriptCallFrame.cpp
1634
    inspector/ScriptCallStack.cpp
1634
    inspector/ScriptCallStack.cpp
1635
    inspector/TimelineRecordFactory.cpp
1635
    inspector/TimelineRecordFactory.cpp
1636
    inspector/TimelineTraceEventProcessor.cpp
1636
    inspector/WorkerConsoleAgent.cpp
1637
    inspector/WorkerConsoleAgent.cpp
1637
    inspector/WorkerDebuggerAgent.cpp
1638
    inspector/WorkerDebuggerAgent.cpp
1638
    inspector/WorkerInspectorController.cpp
1639
    inspector/WorkerInspectorController.cpp
- a/Source/WebCore/GNUmakefile.list.am +2 lines
Lines 3816-3821 webcore_sources += \ a/Source/WebCore/GNUmakefile.list.am_sec1
3816
	Source/WebCore/inspector/ScriptGCEventListener.h \
3816
	Source/WebCore/inspector/ScriptGCEventListener.h \
3817
	Source/WebCore/inspector/TimelineRecordFactory.cpp \
3817
	Source/WebCore/inspector/TimelineRecordFactory.cpp \
3818
	Source/WebCore/inspector/TimelineRecordFactory.h \
3818
	Source/WebCore/inspector/TimelineRecordFactory.h \
3819
	Source/WebCore/inspector/TimelineTraceEventProcessor.cpp \
3820
	Source/WebCore/inspector/TimelineTraceEventProcessor.h \
3819
	Source/WebCore/inspector/WorkerConsoleAgent.cpp \
3821
	Source/WebCore/inspector/WorkerConsoleAgent.cpp \
3820
	Source/WebCore/inspector/WorkerConsoleAgent.h \
3822
	Source/WebCore/inspector/WorkerConsoleAgent.h \
3821
	Source/WebCore/inspector/WorkerDebuggerAgent.cpp \
3823
	Source/WebCore/inspector/WorkerDebuggerAgent.cpp \
- a/Source/WebCore/Target.pri +1 lines
Lines 796-801 SOURCES += \ a/Source/WebCore/Target.pri_sec1
796
    inspector/ScriptCallFrame.cpp \
796
    inspector/ScriptCallFrame.cpp \
797
    inspector/ScriptCallStack.cpp \
797
    inspector/ScriptCallStack.cpp \
798
    inspector/TimelineRecordFactory.cpp \
798
    inspector/TimelineRecordFactory.cpp \
799
    inspector/TimelineTraceEventProcessor.cpp \
799
    inspector/WorkerConsoleAgent.cpp \
800
    inspector/WorkerConsoleAgent.cpp \
800
    inspector/WorkerDebuggerAgent.cpp \
801
    inspector/WorkerDebuggerAgent.cpp \
801
    inspector/WorkerInspectorController.cpp \
802
    inspector/WorkerInspectorController.cpp \
- a/Source/WebCore/WebCore.gypi +2 lines
Lines 1888-1893 a/Source/WebCore/WebCore.gypi_sec1
1888
            'inspector/ScriptGCEventListener.h',
1888
            'inspector/ScriptGCEventListener.h',
1889
            'inspector/TimelineRecordFactory.cpp',
1889
            'inspector/TimelineRecordFactory.cpp',
1890
            'inspector/TimelineRecordFactory.h',
1890
            'inspector/TimelineRecordFactory.h',
1891
            'inspector/TimelineTraceEventProcessor.cpp',
1892
            'inspector/TimelineTraceEventProcessor.h',
1891
            'inspector/WorkerConsoleAgent.cpp',
1893
            'inspector/WorkerConsoleAgent.cpp',
1892
            'inspector/WorkerConsoleAgent.h',
1894
            'inspector/WorkerConsoleAgent.h',
1893
            'inspector/WorkerDebuggerAgent.cpp',
1895
            'inspector/WorkerDebuggerAgent.cpp',
- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +24 lines
Lines 76178-76183 a/Source/WebCore/WebCore.vcproj/WebCore.vcproj_sec1
76178
				>
76178
				>
76179
			</File>
76179
			</File>
76180
			<File
76180
			<File
76181
				RelativePath="..\inspector\TimelineTraceEventProcessor.cpp"
76182
				>
76183
				<FileConfiguration
76184
					Name="Release|Win32"
76185
					ExcludedFromBuild="true"
76186
					>
76187
					<Tool
76188
						Name="VCCLCompilerTool"
76189
					/>
76190
				</FileConfiguration>
76191
				<FileConfiguration
76192
					Name="Production|Win32"
76193
					ExcludedFromBuild="true"
76194
					>
76195
					<Tool
76196
						Name="VCCLCompilerTool"
76197
					/>
76198
				</FileConfiguration>
76199
			</File>
76200
			<File
76201
				RelativePath="..\inspector\TimelineTraceEventProcessor.h"
76202
				>
76203
			</File>
76204
			<File
76181
				RelativePath="..\inspector\WorkerConsoleAgent.cpp"
76205
				RelativePath="..\inspector\WorkerConsoleAgent.cpp"
76182
				>
76206
				>
76183
				<FileConfiguration
76207
				<FileConfiguration
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +8 lines
Lines 1278-1283 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
1278
		46F9D5DF0B0D60170028EE36 /* progressCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46F9D5DC0B0D60170028EE36 /* progressCursor.png */; };
1278
		46F9D5DF0B0D60170028EE36 /* progressCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46F9D5DC0B0D60170028EE36 /* progressCursor.png */; };
1279
		490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; };
1279
		490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; };
1280
		490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; };
1280
		490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; };
1281
		49140256168E02E8002D6C6A /* TimelineTraceEventProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49140254168E02B4002D6C6A /* TimelineTraceEventProcessor.cpp */; };
1282
		49140257168E02EC002D6C6A /* TimelineTraceEventProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49140255168E02B4002D6C6A /* TimelineTraceEventProcessor.h */; };
1281
		49182B5215DCE6F000548418 /* PlatformInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49182B5015DCE6F000548418 /* PlatformInstrumentation.cpp */; };
1283
		49182B5215DCE6F000548418 /* PlatformInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49182B5015DCE6F000548418 /* PlatformInstrumentation.cpp */; };
1282
		49182B5315DCE6F000548418 /* PlatformInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49182B5115DCE6F000548418 /* PlatformInstrumentation.h */; };
1284
		49182B5315DCE6F000548418 /* PlatformInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49182B5115DCE6F000548418 /* PlatformInstrumentation.h */; };
1283
		492863991253B8FC00F792D6 /* ResourceLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
1285
		492863991253B8FC00F792D6 /* ResourceLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 8546-8551 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
8546
		46F9D5DC0B0D60170028EE36 /* progressCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = progressCursor.png; sourceTree = "<group>"; };
8548
		46F9D5DC0B0D60170028EE36 /* progressCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = progressCursor.png; sourceTree = "<group>"; };
8547
		490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
8549
		490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
8548
		490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; };
8550
		490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; };
8551
		49140254168E02B4002D6C6A /* TimelineTraceEventProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineTraceEventProcessor.cpp; sourceTree = "<group>"; };
8552
		49140255168E02B4002D6C6A /* TimelineTraceEventProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineTraceEventProcessor.h; sourceTree = "<group>"; };
8549
		49182B5015DCE6F000548418 /* PlatformInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformInstrumentation.cpp; sourceTree = "<group>"; };
8553
		49182B5015DCE6F000548418 /* PlatformInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformInstrumentation.cpp; sourceTree = "<group>"; };
8550
		49182B5115DCE6F000548418 /* PlatformInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformInstrumentation.h; sourceTree = "<group>"; };
8554
		49182B5115DCE6F000548418 /* PlatformInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformInstrumentation.h; sourceTree = "<group>"; };
8551
		492863981253B8FC00F792D6 /* ResourceLoadInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadInfo.h; sourceTree = "<group>"; };
8555
		492863981253B8FC00F792D6 /* ResourceLoadInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadInfo.h; sourceTree = "<group>"; };
Lines 15026-15031 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
15026
				9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */,
15030
				9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */,
15027
				7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */,
15031
				7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */,
15028
				7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */,
15032
				7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */,
15033
				49140254168E02B4002D6C6A /* TimelineTraceEventProcessor.cpp */,
15034
				49140255168E02B4002D6C6A /* TimelineTraceEventProcessor.h */,
15029
				F382088E147D35F90010BC06 /* WorkerConsoleAgent.cpp */,
15035
				F382088E147D35F90010BC06 /* WorkerConsoleAgent.cpp */,
15030
				F382088F147D35F90010BC06 /* WorkerConsoleAgent.h */,
15036
				F382088F147D35F90010BC06 /* WorkerConsoleAgent.h */,
15031
				F34742DE1343631F00531BC2 /* WorkerDebuggerAgent.cpp */,
15037
				F34742DE1343631F00531BC2 /* WorkerDebuggerAgent.cpp */,
Lines 26006-26011 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
26006
				415071581685067300C3C7B3 /* SelectorFilter.h in Headers */,
26012
				415071581685067300C3C7B3 /* SelectorFilter.h in Headers */,
26007
				419BC2DF1685329900D64D6D /* VisitedLinkState.h in Headers */,
26013
				419BC2DF1685329900D64D6D /* VisitedLinkState.h in Headers */,
26008
				5DA97ECD168E787B000E3676 /* SystemVersionMac.h in Headers */,
26014
				5DA97ECD168E787B000E3676 /* SystemVersionMac.h in Headers */,
26015
				49140257168E02EC002D6C6A /* TimelineTraceEventProcessor.h in Headers */,
26009
			);
26016
			);
26010
			runOnlyForDeploymentPostprocessing = 0;
26017
			runOnlyForDeploymentPostprocessing = 0;
26011
		};
26018
		};
Lines 29128-29133 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
29128
				415071571685067300C3C7B3 /* SelectorFilter.cpp in Sources */,
29135
				415071571685067300C3C7B3 /* SelectorFilter.cpp in Sources */,
29129
				419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */,
29136
				419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */,
29130
				5DA97ECE168E787B000E3676 /* SystemVersionMac.mm in Sources */,
29137
				5DA97ECE168E787B000E3676 /* SystemVersionMac.mm in Sources */,
29138
				49140256168E02E8002D6C6A /* TimelineTraceEventProcessor.cpp in Sources */,
29131
			);
29139
			);
29132
			runOnlyForDeploymentPostprocessing = 0;
29140
			runOnlyForDeploymentPostprocessing = 0;
29133
		};
29141
		};
- a/Source/WebCore/inspector/InspectorAllInOne.cpp +1 lines
Lines 83-88 a/Source/WebCore/inspector/InspectorAllInOne.cpp_sec1
83
#include "ScriptCallFrame.cpp"
83
#include "ScriptCallFrame.cpp"
84
#include "ScriptCallStack.cpp"
84
#include "ScriptCallStack.cpp"
85
#include "TimelineRecordFactory.cpp"
85
#include "TimelineRecordFactory.cpp"
86
#include "TimelineTraceEventProcessor.cpp"
86
#include "WorkerConsoleAgent.cpp"
87
#include "WorkerConsoleAgent.cpp"
87
#include "WorkerDebuggerAgent.cpp"
88
#include "WorkerDebuggerAgent.cpp"
88
#include "WorkerInspectorController.cpp"
89
#include "WorkerInspectorController.cpp"
- a/Source/WebCore/inspector/InspectorClient.h +5 lines
Lines 59-64 public: a/Source/WebCore/inspector/InspectorClient.h_sec1
59
    virtual void clearBrowserCookies() { }
59
    virtual void clearBrowserCookies() { }
60
    virtual bool canMonitorMainThread() { return false; }
60
    virtual bool canMonitorMainThread() { return false; }
61
61
62
    typedef void (*TraceEventCallback)(char phase, const unsigned char*, const char* name, unsigned long long id,
63
        int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues,
64
        unsigned char flags);
65
    virtual void setTraceEventCallback(TraceEventCallback) { }
66
62
    virtual bool canOverrideDeviceMetrics() { return false; }
67
    virtual bool canOverrideDeviceMetrics() { return false; }
63
68
64
    virtual void overrideDeviceMetrics(int /*width*/, int /*height*/, float /*fontScaleFactor*/, bool /*fitWindow*/)
69
    virtual void overrideDeviceMetrics(int /*width*/, int /*height*/, float /*fontScaleFactor*/, bool /*fitWindow*/)
- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp -1 / +5 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 51-56 a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec2
51
#include "ResourceRequest.h"
51
#include "ResourceRequest.h"
52
#include "ResourceResponse.h"
52
#include "ResourceResponse.h"
53
#include "TimelineRecordFactory.h"
53
#include "TimelineRecordFactory.h"
54
#include "TimelineTraceEventProcessor.h"
54
55
55
#include <wtf/CurrentTime.h>
56
#include <wtf/CurrentTime.h>
56
57
Lines 171-176 void InspectorTimelineAgent::start(ErrorString*, const int* maxCallStackDepth) a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec3
171
    m_instrumentingAgents->setInspectorTimelineAgent(this);
172
    m_instrumentingAgents->setInspectorTimelineAgent(this);
172
    ScriptGCEvent::addEventListener(this);
173
    ScriptGCEvent::addEventListener(this);
173
    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
174
    m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
175
    if (m_client)
176
        m_traceEventProcessor = adoptPtr(new TimelineTraceEventProcessor(this, m_client));
174
}
177
}
175
178
176
void InspectorTimelineAgent::stop(ErrorString*)
179
void InspectorTimelineAgent::stop(ErrorString*)
Lines 178-183 void InspectorTimelineAgent::stop(ErrorString*) a/Source/WebCore/inspector/InspectorTimelineAgent.cpp_sec4
178
    if (!m_state->getBoolean(TimelineAgentState::timelineAgentEnabled))
181
    if (!m_state->getBoolean(TimelineAgentState::timelineAgentEnabled))
179
        return;
182
        return;
180
183
184
    m_traceEventProcessor.clear();
181
    m_instrumentingAgents->setInspectorTimelineAgent(0);
185
    m_instrumentingAgents->setInspectorTimelineAgent(0);
182
    ScriptGCEvent::removeEventListener(this);
186
    ScriptGCEvent::removeEventListener(this);
183
187
- a/Source/WebCore/inspector/InspectorTimelineAgent.h +4 lines
Lines 55-60 class IntRect; a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec1
55
class RenderObject;
55
class RenderObject;
56
class ResourceRequest;
56
class ResourceRequest;
57
class ResourceResponse;
57
class ResourceResponse;
58
class TimelineTraceEventProcessor;
58
59
59
typedef String ErrorString;
60
typedef String ErrorString;
60
61
Lines 166-171 public: a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec2
166
    virtual void didResizeImage() OVERRIDE;
167
    virtual void didResizeImage() OVERRIDE;
167
168
168
private:
169
private:
170
    friend class TimelineTraceEventProcessor;
171
169
    struct TimelineRecordEntry {
172
    struct TimelineRecordEntry {
170
        TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, size_t usedHeapSizeAtStart)
173
        TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, size_t usedHeapSizeAtStart)
171
            : record(record), data(data), children(children), type(type), frameId(frameId), usedHeapSizeAtStart(usedHeapSizeAtStart)
174
            : record(record), data(data), children(children), type(type), frameId(frameId), usedHeapSizeAtStart(usedHeapSizeAtStart)
Lines 220-225 private: a/Source/WebCore/inspector/InspectorTimelineAgent.h_sec3
220
    RefPtr<InspectorObject> m_pendingFrameRecord;
223
    RefPtr<InspectorObject> m_pendingFrameRecord;
221
    InspectorType m_inspectorType;
224
    InspectorType m_inspectorType;
222
    InspectorClient* m_client;
225
    InspectorClient* m_client;
226
    OwnPtr<TimelineTraceEventProcessor> m_traceEventProcessor;
223
};
227
};
224
228
225
} // namespace WebCore
229
} // namespace WebCore
- a/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp +219 lines
Line 0 a/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp_sec1
1
/*
2
* Copyright (C) 2012 Google Inc. All rights reserved.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are
6
* met:
7
*
8
*     * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
*     * Redistributions in binary form must reproduce the above
11
* copyright notice, this list of conditions and the following disclaimer
12
* in the documentation and/or other materials provided with the
13
* distribution.
14
*     * Neither the name of Google Inc. nor the names of its
15
* contributors may be used to endorse or promote products derived from
16
* this software without specific prior written permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
#include "config.h"
32
33
#if ENABLE(INSPECTOR)
34
35
#include "TimelineTraceEventProcessor.h"
36
37
#include "InspectorClient.h"
38
#include "InspectorTimelineAgent.h"
39
40
#include <wtf/MainThread.h>
41
#include <wtf/Vector.h>
42
43
namespace WebCore {
44
45
namespace {
46
47
class TraceEventDispatcher {
48
    WTF_MAKE_NONCOPYABLE(TraceEventDispatcher);
49
public:
50
    static TraceEventDispatcher* instance()
51
    {
52
        DEFINE_STATIC_LOCAL(TraceEventDispatcher, instance, ());
53
        return &instance;
54
    }
55
    
56
    void addProcessor(TimelineTraceEventProcessor* processor, InspectorClient* client)
57
    {
58
        m_processors.append(processor);
59
        if (m_processors.size() == 1)
60
            client->setTraceEventCallback(dispatchEvent);
61
    }
62
63
    void removeProcessor(TimelineTraceEventProcessor* processor, InspectorClient* client)
64
    {
65
        size_t index = m_processors.find(processor);
66
        if (index == notFound) {
67
            ASSERT_NOT_REACHED();
68
            return;
69
        }
70
        m_processors[index] = m_processors.last();
71
        m_processors.removeLast();
72
        if (m_processors.isEmpty())
73
            client->setTraceEventCallback(0);
74
    }
75
76
private:
77
    TraceEventDispatcher() { }
78
79
    static void dispatchEvent(char phase, const unsigned char*, const char* name, unsigned long long id,
80
        int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues,
81
        unsigned char flags)
82
    {
83
        if (!isMainThread())
84
            return;
85
86
        Vector<TimelineTraceEventProcessor*>& processors = instance()->m_processors;
87
        for (int i = 0, size = processors.size(); i < size; ++i) {
88
            processors[i]->processEvent(static_cast<TimelineTraceEventProcessor::TraceEventPhase>(phase),
89
                name, id, numArgs, argNames, argTypes, argValues, flags);
90
        }
91
    }
92
93
    Vector<TimelineTraceEventProcessor*> m_processors;
94
};
95
96
} // namespce
97
98
class TraceEventArguments {
99
    WTF_MAKE_NONCOPYABLE(TraceEventArguments);
100
public:
101
    TraceEventArguments(int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues)
102
        : m_size(numArguments)
103
        , m_argumentNames(argumentNames)
104
        , m_argumentTypes(argumentTypes)
105
        , m_argumentValues(argumentValues)
106
    {
107
    }
108
109
    int size() const { return m_size; }
110
111
    bool asBool(const char* name) const
112
    { 
113
        return parameter(name, TypeBool).m_bool;
114
    }
115
    long long asInt(const char* name) const
116
    { 
117
        return parameter(name, TypeInt).m_int;
118
    }
119
    unsigned long long asUInt(const char* name) const 
120
    { 
121
        return parameter(name, TypeUInt).m_uint;
122
    }
123
    double asDouble(const char* name) const
124
    { 
125
        return parameter(name, TypeDouble).m_double;
126
    }
127
    const char* asString(const char* name) const
128
    {
129
        return parameter(name, TypeString).m_string;
130
    }
131
132
private:
133
    // FIXME: use the definition in TraceEvent.h once we expose the latter to all plaforms.
134
    union TraceValueUnion {
135
        bool m_bool;
136
        unsigned long long m_uint;
137
        long long m_int;
138
        double m_double;
139
        const void* m_pointer;
140
        const char* m_string;
141
    };
142
143
    enum TraceValueTypes {
144
        TypeBool = 1,
145
        TypeUInt = 2,
146
        TypeInt = 3,
147
        TypeDouble = 4,
148
        TypePointer = 5,
149
        TypeString = 6,
150
        TypeCopyString = 7
151
    };
152
153
    const TraceValueUnion& parameter(const char* name, TraceValueTypes expectedType) const
154
    {
155
        static TraceValueUnion missingValue;
156
157
        for (int i = 0; i < m_size; ++i) {
158
            if (!strcmp(name, m_argumentNames[i])) {
159
                if (m_argumentTypes[i] != expectedType) {
160
                    ASSERT_NOT_REACHED();
161
                    return missingValue;
162
                }
163
                return *reinterpret_cast<const TraceValueUnion*>(m_argumentValues + i);
164
            }
165
        }
166
        ASSERT_NOT_REACHED();
167
        return missingValue;
168
    }
169
170
    int m_size;
171
    const char* const* m_argumentNames;
172
    const unsigned char* m_argumentTypes;
173
    const unsigned long long* m_argumentValues;
174
};
175
176
TimelineTraceEventProcessor::TimelineTraceEventProcessor(InspectorTimelineAgent* timelineAgent, InspectorClient *client)
177
    : m_timelineAgent(timelineAgent)
178
    , m_inspectorClient(client)
179
{
180
    TraceEventDispatcher::instance()->addProcessor(this, m_inspectorClient);
181
}
182
183
TimelineTraceEventProcessor::~TimelineTraceEventProcessor()
184
{
185
    TraceEventDispatcher::instance()->removeProcessor(this, m_inspectorClient);
186
}
187
188
void TimelineTraceEventProcessor::processEvent(TraceEventPhase phase, const char* name, unsigned long long,
189
    int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues,
190
    unsigned char)
191
{
192
    HashMap<String, EventTypeEntry>::iterator it = m_handlersByType.find(name);
193
    if (it == m_handlersByType.end())
194
        return;
195
    TraceEventHandler handler = 0;
196
    switch (phase) {
197
    case TracePhaseBegin:
198
        handler = it->value.m_begin;
199
        break;
200
    case TracePhaseEnd:
201
        handler = it->value.m_end;
202
        break;
203
    case TracePhaseInstant:
204
        handler = it->value.m_instant;
205
        break;
206
    default:
207
        ASSERT_NOT_REACHED();
208
    }
209
    if (!handler) {
210
        ASSERT_NOT_REACHED();
211
        return;
212
    }
213
    TraceEventArguments arguments(numArgs, argNames, argTypes, argValues);
214
    (this->*handler)(name, phase, arguments);
215
}
216
217
} // namespace WebCore
218
219
#endif // ENABLE(INSPECTOR)
- a/Source/WebCore/inspector/TimelineTraceEventProcessor.h +100 lines
Line 0 a/Source/WebCore/inspector/TimelineTraceEventProcessor.h_sec1
1
/*
2
* Copyright (C) 2012 Google Inc. All rights reserved.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are
6
* met:
7
*
8
*     * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
*     * Redistributions in binary form must reproduce the above
11
* copyright notice, this list of conditions and the following disclaimer
12
* in the documentation and/or other materials provided with the
13
* distribution.
14
*     * Neither the name of Google Inc. nor the names of its
15
* contributors may be used to endorse or promote products derived from
16
* this software without specific prior written permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
#ifndef TimelineTraceEventProcessor_h
32
#define TimelineTraceEventProcessor_h
33
34
#if ENABLE(INSPECTOR)
35
36
#include <wtf/HashMap.h>
37
#include <wtf/Noncopyable.h>
38
#include <wtf/text/WTFString.h>
39
40
namespace WebCore {
41
42
class InspectorClient;
43
class InspectorTimelineAgent;
44
class TraceEventArguments;
45
46
class TimelineTraceEventProcessor {
47
public:
48
    // FIXME: re-use definitions in TraceEvent.h once it's promoted to all platforms.
49
    enum TraceEventPhase {
50
        TracePhaseBegin = 'B',
51
        TracePhaseEnd = 'E',
52
        TracePhaseInstant = 'I'
53
    };
54
55
    TimelineTraceEventProcessor(InspectorTimelineAgent*, InspectorClient*);
56
    ~TimelineTraceEventProcessor();
57
58
    void processEvent(TraceEventPhase, const char* name, unsigned long long id,
59
        int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues,
60
        unsigned char flags);
61
    
62
private:
63
    typedef void (TimelineTraceEventProcessor::*TraceEventHandler)(const char* name, TraceEventPhase, const TraceEventArguments&);
64
65
    struct EventTypeEntry {
66
        EventTypeEntry()
67
            : m_begin(0)
68
            , m_end(0)
69
            , m_instant(0)
70
        {
71
        }
72
        explicit EventTypeEntry(TraceEventHandler instant)
73
            : m_begin(0)
74
            , m_end(0)
75
            , m_instant(instant)
76
        {
77
        };
78
        EventTypeEntry(TraceEventHandler begin, TraceEventHandler end)
79
            : m_begin(begin)
80
            , m_end(end)
81
            , m_instant(0)
82
        {
83
        };
84
85
        TraceEventHandler m_begin;
86
        TraceEventHandler m_end;
87
        TraceEventHandler m_instant;
88
    };
89
90
    InspectorTimelineAgent* m_timelineAgent;
91
    InspectorClient* m_inspectorClient;
92
93
    HashMap<String, EventTypeEntry> m_handlersByType;
94
};
95
96
97
} // namespace WebCore
98
99
#endif // ENABLE(INSPECTOR)
100
#endif // !defined(TimelineTraceEventProcessor_h)
- a/Source/WebKit/chromium/public/WebDevToolsAgentClient.h +6 lines
Lines 77-82 public: a/Source/WebKit/chromium/public/WebDevToolsAgentClient.h_sec1
77
    };
77
    };
78
    virtual void dumpUncountedAllocatedObjects(const InstrumentedObjectSizeProvider*) { }
78
    virtual void dumpUncountedAllocatedObjects(const InstrumentedObjectSizeProvider*) { }
79
79
80
    typedef void (*TraceEventCallback)(char phase, const unsigned char*, const char* name, unsigned long long id,
81
        int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues,
82
        unsigned char flags);
83
84
    virtual void setTraceEventCallback(TraceEventCallback) { }
85
80
protected:
86
protected:
81
    ~WebDevToolsAgentClient() { }
87
    ~WebDevToolsAgentClient() { }
82
};
88
};
- 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::setTraceEventCallback(TraceEventCallback callback)
200
{
201
    if (WebDevToolsAgentImpl* agent = devToolsAgent())
202
        agent->setTraceEventCallback(callback);
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 setTraceEventCallback(TraceEventCallback);
88
89
89
private:
90
private:
90
    WebDevToolsAgentImpl* devToolsAgent();
91
    WebDevToolsAgentImpl* devToolsAgent();
- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +5 lines
Lines 580-585 bool WebDevToolsAgentImpl::captureScreenshot(WTF::String* data) a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp_sec1
580
    return true;
580
    return true;
581
}
581
}
582
582
583
void WebDevToolsAgentImpl::setTraceEventCallback(TraceEventCallback callback)
584
{
585
    m_client->setTraceEventCallback(callback);
586
}
587
583
void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message)
588
void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message)
584
{
589
{
585
    inspectorController()->dispatchMessageFromFrontend(message);
590
    inspectorController()->dispatchMessageFromFrontend(message);
- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h +1 lines
Lines 109-114 public: a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h_sec1
109
109
110
    virtual void getAllocatedObjects(HashSet<const void*>&);
110
    virtual void getAllocatedObjects(HashSet<const void*>&);
111
    virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
111
    virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
112
    virtual void setTraceEventCallback(TraceEventCallback);
112
113
113
    virtual bool captureScreenshot(WTF::String* data);
114
    virtual bool captureScreenshot(WTF::String* data);
114
115

Return to Bug 105796