Diff
Modified: trunk/Source/WebCore/ChangeLog (97231 => 97232)
--- trunk/Source/WebCore/ChangeLog 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebCore/ChangeLog 2011-10-12 05:35:44 UTC (rev 97232)
@@ -1,3 +1,22 @@
+2011-10-11 Antoine Labour <[email protected]>
+
+ Separate compositor client thread from webkit's main thread.
+ https://bugs.webkit.org/show_bug.cgi?id=69048
+
+ Reviewed by Darin Fisher.
+
+ Covered by compositing tests.
+
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::CCLayerTreeHost):
+ * platform/graphics/chromium/cc/CCMainThread.cpp:
+ * platform/graphics/chromium/cc/CCMainThread.h:
+ * platform/graphics/chromium/cc/CCProxy.cpp:
+ (WebCore::CCProxy::isMainThread):
+ (WebCore::CCProxy::setMainThread):
+ (WebCore::CCProxy::CCProxy):
+ * platform/graphics/chromium/cc/CCProxy.h:
+
2011-10-11 Simon Fraser <[email protected]>
Fix Leopard and Snow Leopard builds, which don't use the scrollbar painter.
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (97231 => 97232)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-10-12 05:35:44 UTC (rev 97232)
@@ -33,6 +33,7 @@
#include "TreeSynchronizer.h"
#include "cc/CCLayerTreeHostCommon.h"
#include "cc/CCLayerTreeHostImpl.h"
+#include "cc/CCMainThread.h"
#include "cc/CCSingleThreadProxy.h"
#include "cc/CCThread.h"
#include "cc/CCThreadProxy.h"
@@ -56,6 +57,7 @@
, m_settings(settings)
, m_visible(true)
{
+ CCMainThread::initialize();
ASSERT(CCProxy::isMainThread());
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.cpp (97231 => 97232)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.cpp 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.cpp 2011-10-12 05:35:44 UTC (rev 97232)
@@ -38,9 +38,4 @@
delete task;
}
-void CCMainThread::postTask(PassOwnPtr<Task> task)
-{
- callOnMainThread(performTask, task.leakPtr());
}
-
-}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h (97231 => 97232)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h 2011-10-12 05:35:44 UTC (rev 97232)
@@ -43,6 +43,7 @@
void* m_instance;
};
+ static void initialize();
static void postTask(PassOwnPtr<Task>); // Executes the task on main thread asynchronously.
private:
static void performTask(void*);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.cpp (97231 => 97232)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.cpp 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.cpp 2011-10-12 05:35:44 UTC (rev 97232)
@@ -41,11 +41,12 @@
namespace {
bool fakeImplThread = false;
static WTF::ThreadIdentifier implThreadID;
+static WTF::ThreadIdentifier mainThreadID;
}
bool CCProxy::isMainThread()
{
- return ::isMainThread() && !fakeImplThread;
+ return !fakeImplThread && currentThread() == mainThreadID;
}
bool CCProxy::isImplThread()
@@ -63,6 +64,16 @@
implThreadID = id;
}
+void CCProxy::setMainThread(WTF::ThreadIdentifier id)
+{
+ mainThreadID = id;
+}
+
#endif // !NDEBUG
+CCProxy::CCProxy()
+{
+ ASSERT(isMainThread());
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h (97231 => 97232)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h 2011-10-12 05:35:44 UTC (rev 97232)
@@ -86,10 +86,11 @@
#ifndef NDEBUG
static void setImplThread(bool);
static void setImplThread(WTF::ThreadIdentifier);
+ static void setMainThread(WTF::ThreadIdentifier);
#endif
protected:
- CCProxy() { }
+ CCProxy();
friend class DebugScopedSetImplThread;
};
Modified: trunk/Source/WebKit/chromium/ChangeLog (97231 => 97232)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-10-12 05:35:44 UTC (rev 97232)
@@ -1,3 +1,20 @@
+2011-10-11 Antoine Labour <[email protected]>
+
+ Separate compositor client thread from webkit's main thread.
+ https://bugs.webkit.org/show_bug.cgi?id=69048
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * public/WebKitPlatformSupport.h:
+ (WebKit::WebKitPlatformSupport::currentThread):
+ * src/CCMainThreadImpl.cpp: Added.
+ (WTF::TaskWrapper::TaskWrapper):
+ (WTF::TaskWrapper::~TaskWrapper):
+ (WTF::TaskWrapper::run):
+ (WebCore::CCMainThread::initialize):
+ (WebCore::CCMainThread::postTask):
+
2011-10-11 Simon Fraser <[email protected]>
Make custom scrollbar theme for use in DRT, to reduce pixel diffs between platforms
Modified: trunk/Source/WebKit/chromium/WebKit.gyp (97231 => 97232)
--- trunk/Source/WebKit/chromium/WebKit.gyp 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebKit/chromium/WebKit.gyp 2011-10-12 05:35:44 UTC (rev 97232)
@@ -338,6 +338,7 @@
'src/BlobRegistryProxy.h',
'src/BoundObject.cpp',
'src/BoundObject.h',
+ 'src/CCMainThreadImpl.cpp',
'src/CCThreadImpl.cpp',
'src/CCThreadImpl.h',
'src/ChromeClientImpl.cpp',
Modified: trunk/Source/WebKit/chromium/public/WebKitPlatformSupport.h (97231 => 97232)
--- trunk/Source/WebKit/chromium/public/WebKitPlatformSupport.h 2011-10-12 05:25:03 UTC (rev 97231)
+++ trunk/Source/WebKit/chromium/public/WebKitPlatformSupport.h 2011-10-12 05:35:44 UTC (rev 97232)
@@ -186,7 +186,11 @@
// Creates an embedder-defined thread.
virtual WebThread* createThread(const char* name) { return 0; }
+ // Returns an interface to the current thread. This is owned by the
+ // embedder.
+ virtual WebThread* currentThread() { return 0; }
+
// Message Ports -------------------------------------------------------
// Creates a Message Port Channel. This can be called on any thread.
Added: trunk/Source/WebKit/chromium/src/CCMainThreadImpl.cpp (0 => 97232)
--- trunk/Source/WebKit/chromium/src/CCMainThreadImpl.cpp (rev 0)
+++ trunk/Source/WebKit/chromium/src/CCMainThreadImpl.cpp 2011-10-12 05:35:44 UTC (rev 97232)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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"
+#include "cc/CCMainThread.h"
+
+#include "WebKit.h"
+#include "WebKitPlatformSupport.h"
+#include "WebThread.h"
+#include "cc/CCProxy.h"
+#include <wtf/MainThread.h>
+#include <wtf/OwnPtr.h>
+
+using namespace WTF;
+
+namespace {
+
+bool s_initializedThread = false;
+WebKit::WebThread* s_clientThread = 0;
+
+class TaskWrapper : public WebKit::WebThread::Task {
+public:
+ TaskWrapper(PassOwnPtr<WebCore::CCMainThread::Task> task) : m_task(task) { }
+ virtual ~TaskWrapper() { }
+
+ virtual void run()
+ {
+ m_task->performTask();
+ }
+
+private:
+ OwnPtr<WebCore::CCMainThread::Task> m_task;
+};
+
+} // anonymous namespace
+
+namespace WebCore {
+
+void CCMainThread::initialize()
+{
+ if (s_initializedThread)
+ return;
+ ASSERT(WebKit::webKitPlatformSupport());
+#ifndef NDEBUG
+ WebCore::CCProxy::setMainThread(currentThread());
+#endif
+ s_clientThread = WebKit::webKitPlatformSupport()->currentThread();
+ s_initializedThread = true;
+}
+
+void CCMainThread::postTask(PassOwnPtr<Task> task)
+{
+ ASSERT(s_initializedThread);
+ if (s_clientThread)
+ s_clientThread->postTask(new TaskWrapper(task));
+ else
+ WTF::callOnMainThread(performTask, task.leakPtr());
+}
+
+} // namespace WebCore