Title: [124077] trunk/Source/WebCore
Revision
124077
Author
commit-qu...@webkit.org
Date
2012-07-30 13:05:59 -0700 (Mon, 30 Jul 2012)

Log Message

[chromium] CCThreadTask should not depend on CrossThreadTask and does not need to depend on CrossThreadCopier
https://bugs.webkit.org/show_bug.cgi?id=90132

Patch by James Robinson <jam...@chromium.org> on 2012-07-30
Reviewed by David Levin.

CrossThreadTask is defined in WebCore/dom/ and depends on concepts like ScriptExecutionConcept. CCThreadTask,
being in WebCore/platform/, should not depend on /dom/ or anything from that layer.

CrossThreadCopier is not a layering violation per se, but it's also not at all helpful for CCThreadTask - we
never use any types for which it would be useful.

* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::compositeAndReadback):
(WebCore::CCThreadProxy::finishAllRendering):
(WebCore::CCThreadProxy::initializeContext):
(WebCore::CCThreadProxy::setVisible):
(WebCore::CCThreadProxy::initializeLayerRenderer):
(WebCore::CCThreadProxy::recreateContext):
(WebCore::CCThreadProxy::implSideRenderingStats):
(WebCore::CCThreadProxy::start):
(WebCore::CCThreadProxy::stop):
(WebCore::CCThreadProxy::forceSerializeOnSwapBuffers):
(WebCore::CCThreadProxy::beginFrame):
(WebCore::CCThreadProxy::acquireLayerTextures):
* platform/graphics/chromium/cc/CCThreadTask.h:
(CCThreadTask1):
(WebCore::CCThreadTask1::create):
(WebCore::CCThreadTask1::CCThreadTask1):
(CCThreadTask2):
(WebCore::CCThreadTask2::create):
(WebCore::CCThreadTask2::CCThreadTask2):
(CCThreadTask3):
(WebCore::CCThreadTask3::create):
(WebCore::CCThreadTask3::CCThreadTask3):
(CCThreadTask4):
(WebCore::CCThreadTask4::create):
(WebCore::CCThreadTask4::CCThreadTask4):
(CCThreadTask5):
(WebCore::CCThreadTask5::create):
(WebCore::CCThreadTask5::CCThreadTask5):
(WebCore::createCCThreadTask):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124076 => 124077)


--- trunk/Source/WebCore/ChangeLog	2012-07-30 20:04:06 UTC (rev 124076)
+++ trunk/Source/WebCore/ChangeLog	2012-07-30 20:05:59 UTC (rev 124077)
@@ -1,3 +1,47 @@
+2012-07-30  James Robinson  <jam...@chromium.org>
+
+        [chromium] CCThreadTask should not depend on CrossThreadTask and does not need to depend on CrossThreadCopier
+        https://bugs.webkit.org/show_bug.cgi?id=90132
+
+        Reviewed by David Levin.
+
+        CrossThreadTask is defined in WebCore/dom/ and depends on concepts like ScriptExecutionConcept. CCThreadTask,
+        being in WebCore/platform/, should not depend on /dom/ or anything from that layer.
+
+        CrossThreadCopier is not a layering violation per se, but it's also not at all helpful for CCThreadTask - we
+        never use any types for which it would be useful.
+
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::compositeAndReadback):
+        (WebCore::CCThreadProxy::finishAllRendering):
+        (WebCore::CCThreadProxy::initializeContext):
+        (WebCore::CCThreadProxy::setVisible):
+        (WebCore::CCThreadProxy::initializeLayerRenderer):
+        (WebCore::CCThreadProxy::recreateContext):
+        (WebCore::CCThreadProxy::implSideRenderingStats):
+        (WebCore::CCThreadProxy::start):
+        (WebCore::CCThreadProxy::stop):
+        (WebCore::CCThreadProxy::forceSerializeOnSwapBuffers):
+        (WebCore::CCThreadProxy::beginFrame):
+        (WebCore::CCThreadProxy::acquireLayerTextures):
+        * platform/graphics/chromium/cc/CCThreadTask.h:
+        (CCThreadTask1):
+        (WebCore::CCThreadTask1::create):
+        (WebCore::CCThreadTask1::CCThreadTask1):
+        (CCThreadTask2):
+        (WebCore::CCThreadTask2::create):
+        (WebCore::CCThreadTask2::CCThreadTask2):
+        (CCThreadTask3):
+        (WebCore::CCThreadTask3::create):
+        (WebCore::CCThreadTask3::CCThreadTask3):
+        (CCThreadTask4):
+        (WebCore::CCThreadTask4::create):
+        (WebCore::CCThreadTask4::CCThreadTask4):
+        (CCThreadTask5):
+        (WebCore::CCThreadTask5::create):
+        (WebCore::CCThreadTask5::CCThreadTask5):
+        (WebCore::createCCThreadTask):
+
 2012-07-30  Paul Irish  <paul.ir...@gmail.com>
 
         Web Inspector: Rename Databases to Web SQL

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (124076 => 124077)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-07-30 20:04:06 UTC (rev 124076)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-07-30 20:05:59 UTC (rev 124077)
@@ -26,7 +26,6 @@
 
 #include "cc/CCThreadProxy.h"
 
-#include "GraphicsContext3D.h"
 #include "SharedGraphicsContext3D.h"
 #include "TraceEvent.h"
 #include "cc/CCDelayBasedTimeSource.h"
@@ -111,7 +110,7 @@
 
     // Perform a synchronous commit.
     CCCompletionEvent beginFrameCompletion;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceBeginFrameOnImplThread, AllowCrossThreadAccess(&beginFrameCompletion)));
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceBeginFrameOnImplThread, &beginFrameCompletion));
     beginFrameCompletion.wait();
     m_inCompositeAndReadback = true;
     beginFrame();
@@ -121,7 +120,7 @@
     ReadbackRequest request;
     request.rect = rect;
     request.pixels = pixels;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestReadbackOnImplThread, AllowCrossThreadAccess(&request)));
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestReadbackOnImplThread, &request));
     request.completion.wait();
     return request.success;
 }
@@ -160,7 +159,7 @@
 
     // Make sure all GL drawing is finished on the impl thread.
     CCCompletionEvent completion;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnImplThread, AllowCrossThreadAccess(&completion)));
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnImplThread, &completion));
     completion.wait();
 }
 
@@ -178,7 +177,7 @@
         return false;
 
     CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeContextOnImplThread,
-                                                       AllowCrossThreadAccess(context.leakPtr())));
+                                                       context.leakPtr()));
     return true;
 }
 
@@ -198,7 +197,7 @@
 {
     TRACE_EVENT0("cc", "CCThreadProxy::setVisible");
     CCCompletionEvent completion;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setVisibleOnImplThread, AllowCrossThreadAccess(&completion), visible));
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setVisibleOnImplThread, &completion, visible));
     completion.wait();
 }
 
@@ -219,9 +218,9 @@
     bool initializeSucceeded = false;
     LayerRendererCapabilities capabilities;
     CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnImplThread,
-                                                       AllowCrossThreadAccess(&completion),
-                                                       AllowCrossThreadAccess(&initializeSucceeded),
-                                                       AllowCrossThreadAccess(&capabilities)));
+                                                       &completion,
+                                                       &initializeSucceeded,
+                                                       &capabilities));
     completion.wait();
 
     if (initializeSucceeded) {
@@ -251,10 +250,10 @@
     bool recreateSucceeded = false;
     LayerRendererCapabilities capabilities;
     CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread,
-                                                       AllowCrossThreadAccess(&completion),
-                                                       AllowCrossThreadAccess(context.leakPtr()),
-                                                       AllowCrossThreadAccess(&recreateSucceeded),
-                                                       AllowCrossThreadAccess(&capabilities)));
+                                                       &completion,
+                                                       context.leakPtr(),
+                                                       &recreateSucceeded,
+                                                       &capabilities));
     completion.wait();
 
     if (recreateSucceeded)
@@ -274,8 +273,8 @@
 
     CCCompletionEvent completion;
     CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::implSideRenderingStatsOnImplThread,
-                                                       AllowCrossThreadAccess(&completion),
-                                                       AllowCrossThreadAccess(&stats)));
+                                                       &completion,
+                                                       &stats));
     completion.wait();
 }
 
@@ -376,7 +375,7 @@
     ASSERT(CCProxy::implThread());
     // Create LayerTreeHostImpl.
     CCCompletionEvent completion;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnImplThread, AllowCrossThreadAccess(&completion)));
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnImplThread, &completion));
     completion.wait();
 
     m_started = true;
@@ -393,7 +392,7 @@
         DebugScopedSetMainThreadBlocked mainThreadBlocked;
 
         CCCompletionEvent completion;
-        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnImplThread, AllowCrossThreadAccess(&completion)));
+        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnImplThread, &completion));
         completion.wait();
     }
 
@@ -407,7 +406,7 @@
 void CCThreadProxy::forceSerializeOnSwapBuffers()
 {
     CCCompletionEvent completion;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread, AllowCrossThreadAccess(&completion)));
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread, &completion));
     completion.wait();
 }
 
@@ -542,7 +541,7 @@
         DebugScopedSetMainThreadBlocked mainThreadBlocked;
 
         CCCompletionEvent completion;
-        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, AllowCrossThreadAccess(&completion)));
+        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion));
         completion.wait();
     }
 
@@ -706,7 +705,7 @@
 
     TRACE_EVENT0("cc", "CCThreadProxy::acquireLayerTextures");
     CCCompletionEvent completion;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread, AllowCrossThreadAccess(&completion)));
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread, &completion));
     completion.wait(); // Block until it is safe to write to layer textures from the main thread.
 
     m_texturesAcquired = true;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadTask.h (124076 => 124077)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadTask.h	2012-07-30 20:04:06 UTC (rev 124076)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadTask.h	2012-07-30 20:05:59 UTC (rev 124077)
@@ -24,8 +24,6 @@
 #ifndef CCThreadTask_h
 #define CCThreadTask_h
 
-#include "CrossThreadCopier.h"
-#include "CrossThreadTask.h"
 #include "cc/CCThread.h"
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
@@ -64,15 +62,14 @@
 public:
     typedef void (T::*Method)(MP1);
     typedef CCThreadTask1<T, P1, MP1> CCThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
 
-    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1)
+    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1)
     {
         return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1));
     }
 
 private:
-    CCThreadTask1(T* instance, Method method, Param1 parameter1)
+    CCThreadTask1(T* instance, Method method, P1 parameter1)
         : CCThread::Task(instance)
         , m_method(method)
         , m_parameter1(parameter1)
@@ -94,16 +91,14 @@
 public:
     typedef void (T::*Method)(MP1, MP2);
     typedef CCThreadTask2<T, P1, MP1, P2, MP2> CCThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
-    typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
 
-    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2)
+    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2)
     {
         return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2));
     }
 
 private:
-    CCThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2)
+    CCThreadTask2(T* instance, Method method, P1 parameter1, P2 parameter2)
         : CCThread::Task(instance)
         , m_method(method)
         , m_parameter1(parameter1)
@@ -127,17 +122,14 @@
 public:
     typedef void (T::*Method)(MP1, MP2, MP3);
     typedef CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> CCThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
-    typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
-    typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
 
-    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
+    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3)
     {
         return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3));
     }
 
 private:
-    CCThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
+    CCThreadTask3(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3)
         : CCThread::Task(instance)
         , m_method(method)
         , m_parameter1(parameter1)
@@ -164,18 +156,14 @@
 public:
     typedef void (T::*Method)(MP1, MP2, MP3, MP4);
     typedef CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4> CCThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
-    typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
-    typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
-    typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
 
-    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
+    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4)
     {
         return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4));
     }
 
 private:
-    CCThreadTask4(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
+    CCThreadTask4(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4)
         : CCThread::Task(instance)
         , m_method(method)
         , m_parameter1(parameter1)
@@ -203,19 +191,14 @@
 public:
     typedef void (T::*Method)(MP1, MP2, MP3, MP4, MP5);
     typedef CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CCThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
-    typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
-    typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
-    typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
-    typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
 
-    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
+    static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5)
     {
         return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4, parameter5));
     }
 
 private:
-    CCThreadTask5(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
+    CCThreadTask5(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5)
         : CCThread::Task(instance)
         , m_method(method)
         , m_parameter1(parameter1)
@@ -261,10 +244,10 @@
     void (T::*method)(MP1),
     const P1& parameter1)
 {
-    return CCThreadTask1<T, typename CrossThreadCopier<P1>::Type, MP1>::create(
+    return CCThreadTask1<T, P1, MP1>::create(
         callee,
         method,
-        CrossThreadCopier<P1>::copy(parameter1));
+        parameter1);
 }
 
 template<typename T, typename P1, typename MP1, typename P2, typename MP2>
@@ -274,11 +257,11 @@
     const P1& parameter1,
     const P2& parameter2)
 {
-    return CCThreadTask2<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
+    return CCThreadTask2<T, P1, MP1, P2, MP2>::create(
         callee,
         method,
-        CrossThreadCopier<P1>::copy(parameter1),
-        CrossThreadCopier<P2>::copy(parameter2));
+        parameter1,
+        parameter2);
 }
 
 template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
@@ -289,12 +272,12 @@
     const P2& parameter2,
     const P3& parameter3)
 {
-    return CCThreadTask3<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create(
+    return CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3>::create(
         callee,
         method,
-        CrossThreadCopier<P1>::copy(parameter1),
-        CrossThreadCopier<P2>::copy(parameter2),
-        CrossThreadCopier<P3>::copy(parameter3));
+        parameter1,
+        parameter2,
+        parameter3);
 }
 
 template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
@@ -306,13 +289,13 @@
     const P3& parameter3,
     const P4& parameter4)
 {
-    return CCThreadTask4<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3, typename CrossThreadCopier<P4>::Type, MP4>::create(
+    return CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4>::create(
         callee,
         method,
-        CrossThreadCopier<P1>::copy(parameter1),
-        CrossThreadCopier<P2>::copy(parameter2),
-        CrossThreadCopier<P3>::copy(parameter3),
-        CrossThreadCopier<P4>::copy(parameter4));
+        parameter1,
+        parameter2,
+        parameter3,
+        parameter4);
 
 }
 
@@ -326,14 +309,14 @@
     const P4& parameter4,
     const P5& parameter5)
 {
-    return CCThreadTask5<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3, typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5>::create(
+    return CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5>::create(
         callee,
         method,
-        CrossThreadCopier<P1>::copy(parameter1),
-        CrossThreadCopier<P2>::copy(parameter2),
-        CrossThreadCopier<P3>::copy(parameter3),
-        CrossThreadCopier<P4>::copy(parameter4),
-        CrossThreadCopier<P5>::copy(parameter5));
+        parameter1,
+        parameter2,
+        parameter3,
+        parameter4,
+        parameter5);
 
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to