WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-105796-20121228205312.patch (text/plain), 30.63 KB, created by
Andrey Kosyakov
on 2012-12-28 08:56:02 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andrey Kosyakov
Created:
2012-12-28 08:56:02 PST
Size:
30.63 KB
patch
obsolete
>Subversion Revision: 138538 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e25b06ba4315acb663fcf64982797e04eb1d5fb0..9097f1af6b86ee8afa379826e5e839745bed8013 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,51 @@ >+2012-12-28 Andrey Kosyakov <caseq@chromium.org> >+ >+ Web Inspector: plumb trace events to Timeline agent >+ https://bugs.webkit.org/show_bug.cgi?id=105796 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This exposes a callback to embedder to allow feeding of trace events to Timeline agent. >+ Some events will be specially processed to extract information that will be presented >+ on timeline. >+ >+ * CMakeLists.txt: Added TimelineTraceEventReporter.{h,cpp} >+ * GNUmakefile.list.am: ditto. >+ * Target.pri: ditto. >+ * WebCore.gypi: ditto. >+ * WebCore.vcproj/WebCore.vcproj: ditto. >+ * inspector/InspectorAllInOne.cpp: ditto. >+ * inspector/InspectorClient.h: >+ (InspectorClient): >+ (WebCore::InspectorClient::setTraceEventCallback): >+ * inspector/InspectorTimelineAgent.cpp: >+ (WebCore::InspectorTimelineAgent::start): Enable trace events collection on start. >+ (WebCore::InspectorTimelineAgent::stop): Disable trace events collection on stop. >+ (WebCore): >+ (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): >+ * inspector/InspectorTimelineAgent.h: >+ (WebCore): >+ (InspectorTimelineAgent): >+ * inspector/TimelineTraceEventProcessor.cpp: Added. >+ (TraceEventArguments): >+ (WebCore::TraceEventArguments::TraceEventArguments): A helper to extract arguments from trace event. >+ (WebCore::TraceEventArguments::size): >+ (WebCore::TraceEventArguments::asBool): >+ (WebCore::TraceEventArguments::asInt): >+ (WebCore::TraceEventArguments::asUInt): >+ (WebCore::TraceEventArguments::asDouble): >+ (WebCore::TraceEventArguments::asString): >+ (WebCore::TraceEventArguments::parameter): >+ (WebCore): >+ (WebCore::TimelineTraceEventProcessor::TimelineTraceEventProcessor): >+ (WebCore::TimelineTraceEventProcessor::~TimelineTraceEventProcessor): >+ (WebCore::TimelineTraceEventProcessor::processEvent): >+ * inspector/TimelineTraceEventProcessor.h: Added. >+ (WebCore): >+ (TimelineTraceEventProcessor): >+ (WebCore::TimelineTraceEventProcessor::EventTypeEntry::EventTypeEntry): >+ (EventTypeEntry): >+ > 2012-12-28 Rafael Weinstein <rafaelw@chromium.org> > > Heap-use-after-free in WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index c27ef8bfcebedf181bfe60e25e5c8073b6399f10..37454a6acc72dc9926d739ff07c42fbf3899e412 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,27 @@ >+2012-12-28 Andrey Kosyakov <caseq@chromium.org> >+ >+ Web Inspector: plumb trace events to Timeline agent >+ https://bugs.webkit.org/show_bug.cgi?id=105796 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ - Plumb enabling of trace events to embedder >+ (added setTraceEventCallback to InspectorClient .. WebDevToolsAgentClient) >+ >+ * public/WebDevToolsAgentClient.h: >+ (WebDevToolsAgentClient): >+ (WebKit::WebDevToolsAgentClient::setTraceEventCallback): >+ * src/InspectorClientImpl.cpp: >+ (WebKit::InspectorClientImpl::setTraceEventCallback): >+ (WebKit): >+ * src/InspectorClientImpl.h: >+ (InspectorClientImpl): >+ * src/WebDevToolsAgentImpl.cpp: >+ (WebKit::WebDevToolsAgentImpl::setTraceEventCallback): >+ (WebKit): >+ * src/WebDevToolsAgentImpl.h: >+ (WebDevToolsAgentImpl): >+ > 2012-12-26 Nico Weber <thakis@chromium.org> > > [chromium] Disable unprefixed css transitions until they're functional >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 4943fe66e27c1ec9ff820fe03ba3d6fe5d3b506e..1a150cb62092850a8e84b8b1c0e43c252baea740 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -1633,6 +1633,7 @@ set(WebCore_SOURCES > inspector/ScriptCallFrame.cpp > inspector/ScriptCallStack.cpp > inspector/TimelineRecordFactory.cpp >+ inspector/TimelineTraceEventProcessor.cpp > inspector/WorkerConsoleAgent.cpp > inspector/WorkerDebuggerAgent.cpp > inspector/WorkerInspectorController.cpp >diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am >index e0c9035a2cc61ff94052490efcb58e1a3080693f..103dbac5cebcecb89001982b7c8eb1ed25aeb18f 100644 >--- a/Source/WebCore/GNUmakefile.list.am >+++ b/Source/WebCore/GNUmakefile.list.am >@@ -3816,6 +3816,8 @@ webcore_sources += \ > Source/WebCore/inspector/ScriptGCEventListener.h \ > Source/WebCore/inspector/TimelineRecordFactory.cpp \ > Source/WebCore/inspector/TimelineRecordFactory.h \ >+ Source/WebCore/inspector/TimelineTraceEventProcessor.cpp \ >+ Source/WebCore/inspector/TimelineTraceEventProcessor.h \ > Source/WebCore/inspector/WorkerConsoleAgent.cpp \ > Source/WebCore/inspector/WorkerConsoleAgent.h \ > Source/WebCore/inspector/WorkerDebuggerAgent.cpp \ >diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri >index b2406870ed201158369fd21eabeb974df416b503..05703f5901101d29a4478edcbaa761956e0ef2db 100644 >--- a/Source/WebCore/Target.pri >+++ b/Source/WebCore/Target.pri >@@ -796,6 +796,7 @@ SOURCES += \ > inspector/ScriptCallFrame.cpp \ > inspector/ScriptCallStack.cpp \ > inspector/TimelineRecordFactory.cpp \ >+ inspector/TimelineTraceEventProcessor.cpp \ > inspector/WorkerConsoleAgent.cpp \ > inspector/WorkerDebuggerAgent.cpp \ > inspector/WorkerInspectorController.cpp \ >diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi >index 739bc0bc942beb46b48d86d9f1a20037dea93f55..084b6822f193864615c18c2c5fec0dbb248466c1 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -1888,6 +1888,8 @@ > 'inspector/ScriptGCEventListener.h', > 'inspector/TimelineRecordFactory.cpp', > 'inspector/TimelineRecordFactory.h', >+ 'inspector/TimelineTraceEventProcessor.cpp', >+ 'inspector/TimelineTraceEventProcessor.h', > 'inspector/WorkerConsoleAgent.cpp', > 'inspector/WorkerConsoleAgent.h', > 'inspector/WorkerDebuggerAgent.cpp', >diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >index c16308dbb7f3ca3243825df49b441d71c0d5164a..14e5d2943a7cb175b3f8d66445ca5384118bf06c 100755 >--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj >+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >@@ -76178,6 +76178,30 @@ > > > </File> > <File >+ RelativePath="..\inspector\TimelineTraceEventProcessor.cpp" >+ > >+ <FileConfiguration >+ Name="Release|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ <FileConfiguration >+ Name="Production|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ </File> >+ <File >+ RelativePath="..\inspector\TimelineTraceEventProcessor.h" >+ > >+ </File> >+ <File > RelativePath="..\inspector\WorkerConsoleAgent.cpp" > > > <FileConfiguration >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index fe4b99adc10ab16b6f7de91492309a117dba0b87..fbda69e5e77c85ff7313bf1aad5b00a1e0914308 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1278,6 +1278,8 @@ > 46F9D5DF0B0D60170028EE36 /* progressCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46F9D5DC0B0D60170028EE36 /* progressCursor.png */; }; > 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; }; > 490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; }; >+ 49140256168E02E8002D6C6A /* TimelineTraceEventProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49140254168E02B4002D6C6A /* TimelineTraceEventProcessor.cpp */; }; >+ 49140257168E02EC002D6C6A /* TimelineTraceEventProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49140255168E02B4002D6C6A /* TimelineTraceEventProcessor.h */; }; > 49182B5215DCE6F000548418 /* PlatformInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49182B5015DCE6F000548418 /* PlatformInstrumentation.cpp */; }; > 49182B5315DCE6F000548418 /* PlatformInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49182B5115DCE6F000548418 /* PlatformInstrumentation.h */; }; > 492863991253B8FC00F792D6 /* ResourceLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -8544,6 +8546,8 @@ > 46F9D5DC0B0D60170028EE36 /* progressCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = progressCursor.png; sourceTree = "<group>"; }; > 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; }; > 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; }; >+ 49140254168E02B4002D6C6A /* TimelineTraceEventProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineTraceEventProcessor.cpp; sourceTree = "<group>"; }; >+ 49140255168E02B4002D6C6A /* TimelineTraceEventProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineTraceEventProcessor.h; sourceTree = "<group>"; }; > 49182B5015DCE6F000548418 /* PlatformInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformInstrumentation.cpp; sourceTree = "<group>"; }; > 49182B5115DCE6F000548418 /* PlatformInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformInstrumentation.h; sourceTree = "<group>"; }; > 492863981253B8FC00F792D6 /* ResourceLoadInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadInfo.h; sourceTree = "<group>"; }; >@@ -15022,6 +15026,8 @@ > 9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */, > 7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */, > 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */, >+ 49140254168E02B4002D6C6A /* TimelineTraceEventProcessor.cpp */, >+ 49140255168E02B4002D6C6A /* TimelineTraceEventProcessor.h */, > F382088E147D35F90010BC06 /* WorkerConsoleAgent.cpp */, > F382088F147D35F90010BC06 /* WorkerConsoleAgent.h */, > F34742DE1343631F00531BC2 /* WorkerDebuggerAgent.cpp */, >@@ -25999,6 +26005,7 @@ > E13EF3441684ECF40034C83F /* NetworkStorageSession.h in Headers */, > 415071581685067300C3C7B3 /* SelectorFilter.h in Headers */, > 419BC2DF1685329900D64D6D /* VisitedLinkState.h in Headers */, >+ 49140257168E02EC002D6C6A /* TimelineTraceEventProcessor.h in Headers */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >@@ -29120,6 +29127,7 @@ > E13EF34916850C470034C83F /* NetworkStorageSessionCFNet.cpp in Sources */, > 415071571685067300C3C7B3 /* SelectorFilter.cpp in Sources */, > 419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */, >+ 49140256168E02E8002D6C6A /* TimelineTraceEventProcessor.cpp in Sources */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >diff --git a/Source/WebCore/inspector/InspectorAllInOne.cpp b/Source/WebCore/inspector/InspectorAllInOne.cpp >index 9c9ff20859c2d8cb856347d67b81131a7bb89ebf..b113dd9ed2f26d7cd84264f12d544d43ad35477e 100644 >--- a/Source/WebCore/inspector/InspectorAllInOne.cpp >+++ b/Source/WebCore/inspector/InspectorAllInOne.cpp >@@ -83,6 +83,7 @@ > #include "ScriptCallFrame.cpp" > #include "ScriptCallStack.cpp" > #include "TimelineRecordFactory.cpp" >+#include "TimelineTraceEventProcessor.cpp" > #include "WorkerConsoleAgent.cpp" > #include "WorkerDebuggerAgent.cpp" > #include "WorkerInspectorController.cpp" >diff --git a/Source/WebCore/inspector/InspectorClient.h b/Source/WebCore/inspector/InspectorClient.h >index 948df028cb769a3431a6121ebb983073c0b05b97..5d6546a9d21b78829a524d31002913520f3c1e9b 100644 >--- a/Source/WebCore/inspector/InspectorClient.h >+++ b/Source/WebCore/inspector/InspectorClient.h >@@ -59,6 +59,11 @@ public: > virtual void clearBrowserCookies() { } > virtual bool canMonitorMainThread() { return false; } > >+ typedef void (*TraceEventCallback)(char phase, const unsigned char*, const char* name, unsigned long long id, >+ int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues, >+ unsigned char flags); >+ virtual void setTraceEventCallback(TraceEventCallback) { } >+ > virtual bool canOverrideDeviceMetrics() { return false; } > > virtual void overrideDeviceMetrics(int /*width*/, int /*height*/, float /*fontScaleFactor*/, bool /*fitWindow*/) >diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/InspectorTimelineAgent.cpp >index ac7adcb0aa356fe770cdffc3039692566578a257..fb9e94cc51cf513b2ac73995e37bc40b975fceb3 100644 >--- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp >+++ b/Source/WebCore/inspector/InspectorTimelineAgent.cpp >@@ -1,5 +1,5 @@ > /* >-* Copyright (C) 2009 Google Inc. All rights reserved. >+* Copyright (C) 2012 Google Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -51,6 +51,7 @@ > #include "ResourceRequest.h" > #include "ResourceResponse.h" > #include "TimelineRecordFactory.h" >+#include "TimelineTraceEventProcessor.h" > > #include <wtf/CurrentTime.h> > >@@ -171,6 +172,8 @@ void InspectorTimelineAgent::start(ErrorString*, const int* maxCallStackDepth) > m_instrumentingAgents->setInspectorTimelineAgent(this); > ScriptGCEvent::addEventListener(this); > m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true); >+ if (m_client) >+ m_traceEventProcessor = adoptPtr(new TimelineTraceEventProcessor(this, m_client)); > } > > void InspectorTimelineAgent::stop(ErrorString*) >@@ -178,6 +181,7 @@ void InspectorTimelineAgent::stop(ErrorString*) > if (!m_state->getBoolean(TimelineAgentState::timelineAgentEnabled)) > return; > >+ m_traceEventProcessor.clear(); > m_instrumentingAgents->setInspectorTimelineAgent(0); > ScriptGCEvent::removeEventListener(this); > >diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.h b/Source/WebCore/inspector/InspectorTimelineAgent.h >index e7062a118188facdd5434a1211d3c7fc5f06e966..b3bd0080f8eccff39c06edda67705c9d2728a05f 100644 >--- a/Source/WebCore/inspector/InspectorTimelineAgent.h >+++ b/Source/WebCore/inspector/InspectorTimelineAgent.h >@@ -55,6 +55,7 @@ class IntRect; > class RenderObject; > class ResourceRequest; > class ResourceResponse; >+class TimelineTraceEventProcessor; > > typedef String ErrorString; > >@@ -166,6 +167,8 @@ public: > virtual void didResizeImage() OVERRIDE; > > private: >+ friend class TimelineTraceEventProcessor; >+ > struct TimelineRecordEntry { > TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, size_t usedHeapSizeAtStart) > : record(record), data(data), children(children), type(type), frameId(frameId), usedHeapSizeAtStart(usedHeapSizeAtStart) >@@ -220,6 +223,7 @@ private: > RefPtr<InspectorObject> m_pendingFrameRecord; > InspectorType m_inspectorType; > InspectorClient* m_client; >+ OwnPtr<TimelineTraceEventProcessor> m_traceEventProcessor; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp b/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..73a16cf470a72b9179cd20de136f0e6c6c746076 >--- /dev/null >+++ b/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp >@@ -0,0 +1,219 @@ >+/* >+* Copyright (C) 2012 Google Inc. All rights reserved. >+* >+* Redistribution and use in source and binary forms, with or without >+* modification, are permitted provided that the following conditions are >+* met: >+* >+* * Redistributions of source code must retain the above copyright >+* notice, this list of conditions and the following disclaimer. >+* * Redistributions in binary form must reproduce the above >+* copyright notice, this list of conditions and the following disclaimer >+* in the documentation and/or other materials provided with the >+* distribution. >+* * Neither the name of Google Inc. nor the names of its >+* contributors may be used to endorse or promote products derived from >+* this software without specific prior written permission. >+* >+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+*/ >+ >+#include "config.h" >+ >+#if ENABLE(INSPECTOR) >+ >+#include "TimelineTraceEventProcessor.h" >+ >+#include "InspectorClient.h" >+#include "InspectorTimelineAgent.h" >+ >+#include <wtf/MainThread.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+namespace { >+ >+class TraceEventDispatcher { >+ WTF_MAKE_NONCOPYABLE(TraceEventDispatcher); >+public: >+ static TraceEventDispatcher* instance() >+ { >+ DEFINE_STATIC_LOCAL(TraceEventDispatcher, instance, ()); >+ return &instance; >+ } >+ >+ void addProcessor(TimelineTraceEventProcessor* processor, InspectorClient* client) >+ { >+ m_processors.append(processor); >+ if (m_processors.size() == 1) >+ client->setTraceEventCallback(dispatchEvent); >+ } >+ >+ void removeProcessor(TimelineTraceEventProcessor* processor, InspectorClient* client) >+ { >+ size_t index = m_processors.find(processor); >+ if (index == notFound) { >+ ASSERT_NOT_REACHED(); >+ return; >+ } >+ m_processors[index] = m_processors.last(); >+ m_processors.removeLast(); >+ if (m_processors.isEmpty()) >+ client->setTraceEventCallback(0); >+ } >+ >+private: >+ TraceEventDispatcher() { } >+ >+ static void dispatchEvent(char phase, const unsigned char*, const char* name, unsigned long long id, >+ int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues, >+ unsigned char flags) >+ { >+ if (!isMainThread()) >+ return; >+ >+ Vector<TimelineTraceEventProcessor*>& processors = instance()->m_processors; >+ for (int i = 0, size = processors.size(); i < size; ++i) { >+ processors[i]->processEvent(static_cast<TimelineTraceEventProcessor::TraceEventPhase>(phase), >+ name, id, numArgs, argNames, argTypes, argValues, flags); >+ } >+ } >+ >+ Vector<TimelineTraceEventProcessor*> m_processors; >+}; >+ >+} // namespce >+ >+class TraceEventArguments { >+ WTF_MAKE_NONCOPYABLE(TraceEventArguments); >+public: >+ TraceEventArguments(int numArguments, const char* const* argumentNames, const unsigned char* argumentTypes, const unsigned long long* argumentValues) >+ : m_size(numArguments) >+ , m_argumentNames(argumentNames) >+ , m_argumentTypes(argumentTypes) >+ , m_argumentValues(argumentValues) >+ { >+ } >+ >+ int size() const { return m_size; } >+ >+ bool asBool(const char* name) const >+ { >+ return parameter(name, TypeBool).m_bool; >+ } >+ long long asInt(const char* name) const >+ { >+ return parameter(name, TypeInt).m_int; >+ } >+ unsigned long long asUInt(const char* name) const >+ { >+ return parameter(name, TypeUInt).m_uint; >+ } >+ double asDouble(const char* name) const >+ { >+ return parameter(name, TypeDouble).m_double; >+ } >+ const char* asString(const char* name) const >+ { >+ return parameter(name, TypeString).m_string; >+ } >+ >+private: >+ // FIXME: use the definition in TraceEvent.h once we expose the latter to all plaforms. >+ union TraceValueUnion { >+ bool m_bool; >+ unsigned long long m_uint; >+ long long m_int; >+ double m_double; >+ const void* m_pointer; >+ const char* m_string; >+ }; >+ >+ enum TraceValueTypes { >+ TypeBool = 1, >+ TypeUInt = 2, >+ TypeInt = 3, >+ TypeDouble = 4, >+ TypePointer = 5, >+ TypeString = 6, >+ TypeCopyString = 7 >+ }; >+ >+ const TraceValueUnion& parameter(const char* name, TraceValueTypes expectedType) const >+ { >+ static TraceValueUnion missingValue; >+ >+ for (int i = 0; i < m_size; ++i) { >+ if (!strcmp(name, m_argumentNames[i])) { >+ if (m_argumentTypes[i] != expectedType) { >+ ASSERT_NOT_REACHED(); >+ return missingValue; >+ } >+ return *reinterpret_cast<const TraceValueUnion*>(m_argumentValues + i); >+ } >+ } >+ ASSERT_NOT_REACHED(); >+ return missingValue; >+ } >+ >+ int m_size; >+ const char* const* m_argumentNames; >+ const unsigned char* m_argumentTypes; >+ const unsigned long long* m_argumentValues; >+}; >+ >+TimelineTraceEventProcessor::TimelineTraceEventProcessor(InspectorTimelineAgent* timelineAgent, InspectorClient *client) >+ : m_timelineAgent(timelineAgent) >+ , m_inspectorClient(client) >+{ >+ TraceEventDispatcher::instance()->addProcessor(this, m_inspectorClient); >+} >+ >+TimelineTraceEventProcessor::~TimelineTraceEventProcessor() >+{ >+ TraceEventDispatcher::instance()->removeProcessor(this, m_inspectorClient); >+} >+ >+void TimelineTraceEventProcessor::processEvent(TraceEventPhase phase, const char* name, unsigned long long id, >+ int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues, >+ unsigned char flags) >+{ >+ HashMap<String, EventTypeEntry>::iterator it = m_handlersByType.find(name); >+ if (it == m_handlersByType.end()) >+ return; >+ TraceEventHandler handler = 0; >+ switch (phase) { >+ case TracePhaseBegin: >+ handler = it->value.m_begin; >+ break; >+ case TracePhaseEnd: >+ handler = it->value.m_end; >+ break; >+ case TracePhaseInstant: >+ handler = it->value.m_instant; >+ break; >+ default: >+ ASSERT_NOT_REACHED(); >+ } >+ if (!handler) { >+ ASSERT_NOT_REACHED(); >+ return; >+ } >+ TraceEventArguments arguments(numArgs, argNames, argTypes, argValues); >+ (this->*handler)(name, phase, arguments); >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(INSPECTOR) >diff --git a/Source/WebCore/inspector/TimelineTraceEventProcessor.h b/Source/WebCore/inspector/TimelineTraceEventProcessor.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8bab51c74f617af0d15d5818382685adaef7a75d >--- /dev/null >+++ b/Source/WebCore/inspector/TimelineTraceEventProcessor.h >@@ -0,0 +1,100 @@ >+/* >+* Copyright (C) 2012 Google Inc. All rights reserved. >+* >+* Redistribution and use in source and binary forms, with or without >+* modification, are permitted provided that the following conditions are >+* met: >+* >+* * Redistributions of source code must retain the above copyright >+* notice, this list of conditions and the following disclaimer. >+* * Redistributions in binary form must reproduce the above >+* copyright notice, this list of conditions and the following disclaimer >+* in the documentation and/or other materials provided with the >+* distribution. >+* * Neither the name of Google Inc. nor the names of its >+* contributors may be used to endorse or promote products derived from >+* this software without specific prior written permission. >+* >+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+*/ >+ >+#ifndef TimelineTraceEventProcessor_h >+#define TimelineTraceEventProcessor_h >+ >+#if ENABLE(INSPECTOR) >+ >+#include <wtf/HashMap.h> >+#include <wtf/Noncopyable.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+class InspectorClient; >+class InspectorTimelineAgent; >+class TraceEventArguments; >+ >+class TimelineTraceEventProcessor { >+public: >+ // FIXME: re-use definitions in TraceEvent.h once it's promoted to all platforms. >+ enum TraceEventPhase { >+ TracePhaseBegin = 'B', >+ TracePhaseEnd = 'E', >+ TracePhaseInstant = 'I' >+ }; >+ >+ TimelineTraceEventProcessor(InspectorTimelineAgent*, InspectorClient*); >+ ~TimelineTraceEventProcessor(); >+ >+ void processEvent(TraceEventPhase, const char* name, unsigned long long id, >+ int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues, >+ unsigned char flags); >+ >+private: >+ typedef void (TimelineTraceEventProcessor::*TraceEventHandler)(const char* name, TraceEventPhase, const TraceEventArguments&); >+ >+ struct EventTypeEntry { >+ EventTypeEntry() >+ : m_begin(0) >+ , m_end(0) >+ , m_instant(0) >+ { >+ } >+ explicit EventTypeEntry(TraceEventHandler instant) >+ : m_begin(0) >+ , m_end(0) >+ , m_instant(instant) >+ { >+ }; >+ EventTypeEntry(TraceEventHandler begin, TraceEventHandler end) >+ : m_begin(begin) >+ , m_end(end) >+ , m_instant(0) >+ { >+ }; >+ >+ TraceEventHandler m_begin; >+ TraceEventHandler m_end; >+ TraceEventHandler m_instant; >+ }; >+ >+ InspectorTimelineAgent* m_timelineAgent; >+ InspectorClient* m_inspectorClient; >+ >+ HashMap<String, EventTypeEntry> m_handlersByType; >+}; >+ >+ >+} // namespace WebCore >+ >+#endif // ENABLE(INSPECTOR) >+#endif // !defined(TimelineTraceEventProcessor_h) >diff --git a/Source/WebKit/chromium/public/WebDevToolsAgentClient.h b/Source/WebKit/chromium/public/WebDevToolsAgentClient.h >index beb3e832f9748275f4bebca05cf41ea76749070a..a513c93682f46bb8dfbe5dc322a634b564927e55 100644 >--- a/Source/WebKit/chromium/public/WebDevToolsAgentClient.h >+++ b/Source/WebKit/chromium/public/WebDevToolsAgentClient.h >@@ -77,6 +77,12 @@ public: > }; > virtual void dumpUncountedAllocatedObjects(const InstrumentedObjectSizeProvider*) { } > >+ typedef void (*TraceEventCallback)(char phase, const unsigned char*, const char* name, unsigned long long id, >+ int numArgs, const char* const* argNames, const unsigned char* argTypes, const unsigned long long* argValues, >+ unsigned char flags); >+ >+ virtual void setTraceEventCallback(TraceEventCallback) { } >+ > protected: > ~WebDevToolsAgentClient() { } > }; >diff --git a/Source/WebKit/chromium/src/InspectorClientImpl.cpp b/Source/WebKit/chromium/src/InspectorClientImpl.cpp >index bab5816bfd6908efa0f8c169f0c801a24c879246..fbcccd7e1f8f66c2ae0c2e5b22e8a67819d66831 100644 >--- a/Source/WebKit/chromium/src/InspectorClientImpl.cpp >+++ b/Source/WebKit/chromium/src/InspectorClientImpl.cpp >@@ -196,6 +196,12 @@ bool InspectorClientImpl::captureScreenshot(String* data) > return false; > } > >+void InspectorClientImpl::setTraceEventCallback(TraceEventCallback callback) >+{ >+ if (WebDevToolsAgentImpl* agent = devToolsAgent()) >+ agent->setTraceEventCallback(callback); >+} >+ > WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent() > { > return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent()); >diff --git a/Source/WebKit/chromium/src/InspectorClientImpl.h b/Source/WebKit/chromium/src/InspectorClientImpl.h >index 2033e3f69098bb096d0500f9511c04fa2dfd7749..94a37f6d398ff8b6401032c73b7a4e4748c4cd40 100644 >--- a/Source/WebKit/chromium/src/InspectorClientImpl.h >+++ b/Source/WebKit/chromium/src/InspectorClientImpl.h >@@ -85,6 +85,7 @@ public: > virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&); > > virtual bool captureScreenshot(WTF::String* data); >+ virtual void setTraceEventCallback(TraceEventCallback); > > private: > WebDevToolsAgentImpl* devToolsAgent(); >diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp >index b58cf61b4d005f22eda29c2c7ba5c5524c31e135..83a770993bdb527f0bd9627fe2f7b99e44b92baa 100644 >--- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp >+++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp >@@ -580,6 +580,11 @@ bool WebDevToolsAgentImpl::captureScreenshot(WTF::String* data) > return true; > } > >+void WebDevToolsAgentImpl::setTraceEventCallback(TraceEventCallback callback) >+{ >+ m_client->setTraceEventCallback(callback); >+} >+ > void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message) > { > inspectorController()->dispatchMessageFromFrontend(message); >diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h >index e0f2b14abb572bb338aa45eb3bc2c8a4f8369a1b..bfd7b70947447c5c8b268fa2f95122bf47618c3c 100644 >--- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h >+++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h >@@ -109,6 +109,7 @@ public: > > virtual void getAllocatedObjects(HashSet<const void*>&); > virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&); >+ virtual void setTraceEventCallback(TraceEventCallback); > > virtual bool captureScreenshot(WTF::String* data); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
buildbot
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 105796
:
180791
|
180876
|
180881
|
180922
|
180932
|
186000
|
186015
|
186381
|
186384
|
186389
|
190277