[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

mrowe at apple.com mrowe at apple.com
Sun Feb 20 23:40:46 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit bc7f1116a8b7a798464ce9a448cfb6174a8f4ed3
Author: mrowe at apple.com <mrowe at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 24 03:26:48 2011 +0000

    Build fix after r76459.
    
    Static member variables or globals of types that have constructors or destructors are bad as
    they generate static initializers and destructors. This is code that is run either at link time
    when the library is loaded in to memory or at application termination time. Both of these are
    terrible for performance and are thus outlawed in WebKit code.
    
    The typical solution is to replace the static member or global with a function that allocates
    the necessary variable on the heap. The variable is leaked to prevent it from being destroyed
    at application termination time. The DEFINE_STATIC_LOCAL macro wraps this in to a concise little
    package, but sadly fails to work in this case due to the type containing multiple template
    parameters.
    
    * inspector/InspectorInstrumentation.cpp:
    (WebCore::InspectorInstrumentation::inspectorAgents):
    * inspector/InspectorInstrumentation.h:
    (WebCore::InspectorInstrumentation::bindInspectorAgent):
    (WebCore::InspectorInstrumentation::unbindInspectorAgent):
    (WebCore::InspectorInstrumentation::inspectorAgentForPage):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76477 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 99f5b76..47ea169 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2011-01-23  Mark Rowe  <mrowe at apple.com>
+
+        Build fix after r76459.
+
+        Static member variables or globals of types that have constructors or destructors are bad as
+        they generate static initializers and destructors. This is code that is run either at link time
+        when the library is loaded in to memory or at application termination time. Both of these are
+        terrible for performance and are thus outlawed in WebKit code.
+
+        The typical solution is to replace the static member or global with a function that allocates
+        the necessary variable on the heap. The variable is leaked to prevent it from being destroyed
+        at application termination time. The DEFINE_STATIC_LOCAL macro wraps this in to a concise little
+        package, but sadly fails to work in this case due to the type containing multiple template
+        parameters.
+        
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::inspectorAgents):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::bindInspectorAgent):
+        (WebCore::InspectorInstrumentation::unbindInspectorAgent):
+        (WebCore::InspectorInstrumentation::inspectorAgentForPage):
+
 2011-01-21  Vangelis Kokkevis  <vangelis at chromium.org>
 
         Reviewed by Kenneth Russell.
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
index 66951ec..d281b75 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
@@ -61,7 +61,12 @@ static const char* const setTimerEventName = "setTimer";
 static const char* const clearTimerEventName = "clearTimer";
 static const char* const timerFiredEventName = "timerFired";
 
-HashMap<Page*, InspectorAgent*> InspectorInstrumentation::s_inspectorAgents;
+HashMap<Page*, InspectorAgent*>& InspectorInstrumentation::inspectorAgents()
+{
+    static HashMap<Page*, InspectorAgent*>& agents = *new HashMap<Page*, InspectorAgent*>;
+    return agents;
+}
+
 int InspectorInstrumentation::s_frontendCounter = 0;
 
 static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
index 2835055..c1d25b0 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
@@ -172,8 +172,8 @@ public:
 #endif
 
 #if ENABLE(INSPECTOR)
-    static void bindInspectorAgent(Page* page, InspectorAgent* inspectorAgent) { s_inspectorAgents.set(page, inspectorAgent); }
-    static void unbindInspectorAgent(Page* page) { s_inspectorAgents.remove(page); }
+    static void bindInspectorAgent(Page* page, InspectorAgent* inspectorAgent) { inspectorAgents().set(page, inspectorAgent); }
+    static void unbindInspectorAgent(Page* page) { inspectorAgents().remove(page); }
     static void frontendCreated() { s_frontendCounter += 1; }
     static void frontendDeleted() { s_frontendCounter -= 1; }
     static bool hasFrontends() { return s_frontendCounter; }
@@ -297,7 +297,7 @@ private:
     static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
     static InspectorResourceAgent* retrieveResourceAgent(InspectorAgent*);
 
-    static HashMap<Page*, InspectorAgent*> s_inspectorAgents;
+    static HashMap<Page*, InspectorAgent*>& inspectorAgents();
     static int s_frontendCounter;
 #endif
 };
@@ -938,7 +938,7 @@ inline InspectorAgent* InspectorInstrumentation::inspectorAgentForPage(Page* pag
 {
     if (!page)
         return 0;
-    return s_inspectorAgents.get(page);
+    return inspectorAgents().get(page);
 }
 
 inline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForContext(ScriptExecutionContext* context)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list