summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/chromium/cc
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/chromium/cc')
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp3
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h3
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCCompletionEvent.h62
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp142
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h13
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp7
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h4
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCMainThread.cpp46
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h53
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCMainThreadTask.h220
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp3
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h3
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCThread.cpp79
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCThread.h75
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCThreadTask.h279
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp3
-rw-r--r--Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h3
17 files changed, 936 insertions, 62 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp
index 649d049..d70e15c 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp
@@ -47,7 +47,7 @@ CCCanvasLayerImpl::~CCCanvasLayerImpl()
{
}
-void CCCanvasLayerImpl::draw()
+void CCCanvasLayerImpl::draw(const IntRect&)
{
ASSERT(layerRenderer());
const CCCanvasLayerImpl::Program* program = layerRenderer()->canvasLayerProgram();
@@ -77,4 +77,3 @@ void CCCanvasLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
}
#endif // USE(ACCELERATED_COMPOSITING)
-
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h
index 8cbf8d1..3aa917c 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h
@@ -42,7 +42,7 @@ public:
typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexFlipAlpha> Program;
- virtual void draw();
+ virtual void draw(const IntRect&);
virtual void dumpLayerProperties(TextStream&, int indent) const;
@@ -58,4 +58,3 @@ private:
}
#endif // CCCanvasLayerImpl_h
-
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCompletionEvent.h b/Source/WebCore/platform/graphics/chromium/cc/CCCompletionEvent.h
new file mode 100644
index 0000000..a8ac151
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCCompletionEvent.h
@@ -0,0 +1,62 @@
+/*
+ * 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 INC. 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 INC. 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.
+ */
+
+#ifndef CCCompletionEvent_h
+#define CCCompletionEvent_h
+
+#include <wtf/ThreadingPrimitives.h>
+
+namespace WebCore {
+
+class CCCompletionEvent {
+public:
+ CCCompletionEvent()
+ {
+ m_mutex.lock();
+ }
+
+ ~CCCompletionEvent()
+ {
+ m_mutex.unlock();
+ }
+
+ void wait()
+ {
+ m_condition.wait(m_mutex);
+ }
+
+ void signal()
+ {
+ MutexLocker lock(m_mutex);
+ m_condition.signal();
+ }
+
+private:
+ Mutex m_mutex;
+ ThreadCondition m_condition;
+};
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
index 404944b..d22b098 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
@@ -44,13 +44,30 @@ namespace WebCore {
using namespace std;
CCHeadsUpDisplay::CCHeadsUpDisplay(LayerRendererChromium* owner)
- : m_currentFrameNumber(0)
+ : m_currentFrameNumber(1)
+ , m_filteredFrameTime(0)
, m_layerRenderer(owner)
, m_showFPSCounter(false)
, m_showPlatformLayerTree(false)
{
m_presentTimeHistoryInSec[0] = currentTime();
m_presentTimeHistoryInSec[1] = m_presentTimeHistoryInSec[0];
+ for (int i = 2; i < kPresentHistorySize; i++)
+ m_presentTimeHistoryInSec[i] = 0;
+
+ FontDescription mediumFontDesc;
+ mediumFontDesc.setGenericFamily(FontDescription::MonospaceFamily);
+ mediumFontDesc.setComputedSize(20);
+
+ m_mediumFont = adoptPtr(new Font(mediumFontDesc, 0, 0));
+ m_mediumFont->update(0);
+
+ FontDescription smallFontDesc;
+ smallFontDesc.setGenericFamily(FontDescription::MonospaceFamily);
+ smallFontDesc.setComputedSize(10);
+
+ m_smallFont = adoptPtr(new Font(smallFontDesc, 0, 0));
+ m_smallFont->update(0);
}
CCHeadsUpDisplay::~CCHeadsUpDisplay()
@@ -79,7 +96,7 @@ void CCHeadsUpDisplay::draw()
PlatformCanvas canvas;
canvas.resize(hudSize);
{
- PlatformCanvas::Painter painter(&canvas);
+ PlatformCanvas::Painter painter(&canvas, PlatformCanvas::Painter::GrayscaleText);
drawHudContents(painter.context(), hudSize);
}
@@ -92,7 +109,7 @@ void CCHeadsUpDisplay::draw()
}
// Draw the HUD onto the default render surface.
- const ContentLayerChromium::Program* program = m_layerRenderer->contentLayerProgram();
+ const LayerTilerChromium::Program* program = m_layerRenderer->tilerProgram();
ASSERT(program && program->initialized());
GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0));
m_hudTexture->bindTexture();
@@ -111,59 +128,98 @@ void CCHeadsUpDisplay::draw()
void CCHeadsUpDisplay::drawHudContents(GraphicsContext* ctx, const IntSize& hudSize)
{
- FontDescription mediumFontDesc;
- mediumFontDesc.setGenericFamily(FontDescription::MonospaceFamily);
- mediumFontDesc.setComputedSize(12);
- Font mediumFont(mediumFontDesc, 0, 0);
- mediumFont.update(0);
-
- FontDescription smallFontDesc;
- smallFontDesc.setGenericFamily(FontDescription::MonospaceFamily);
- smallFontDesc.setComputedSize(10);
- Font smallFont(smallFontDesc, 0, 0);
- smallFont.update(0);
-
- // We haven't finished rendering yet, so we don't now the "current" present time.
- // So, consider the *last two* present times and use those as our present time.
- double secForLastFrame = m_presentTimeHistoryInSec[(m_currentFrameNumber - 1) % 2] - m_presentTimeHistoryInSec[m_currentFrameNumber % 2];
-
- int y = 14;
-
if (m_showPlatformLayerTree) {
ctx->setFillColor(Color(0, 0, 0, 192), ColorSpaceDeviceRGB);
ctx->fillRect(FloatRect(0, 0, hudSize.width(), hudSize.height()));
}
- // Draw fps.
- String topLine = "";
- if (secForLastFrame > 0 && m_showFPSCounter) {
- double fps = 1.0 / secForLastFrame;
- topLine += String::format("FPS: %3.1f", fps);
- }
- if (topLine.length()) {
- ctx->setFillColor(Color(0, 0, 0, 255), ColorSpaceDeviceRGB);
- TextRun run(topLine);
- ctx->fillRect(FloatRect(2, 2, mediumFont.width(run) + 2.0f, 15));
+ int fpsCounterHeight = m_mediumFont->fontMetrics().floatHeight() + 2;
+ int fpsCounterTop = 2;
+ int platformLayerTreeTop;
+ if (m_showFPSCounter)
+ platformLayerTreeTop = fpsCounterTop + fpsCounterHeight + 2;
+ else
+ platformLayerTreeTop = 0;
+
+ if (m_showFPSCounter)
+ drawFPSCounter(ctx, fpsCounterTop, fpsCounterHeight);
+
+ if (m_showPlatformLayerTree)
+ drawPlatformLayerTree(ctx, platformLayerTreeTop);
+}
+
+void CCHeadsUpDisplay::drawFPSCounter(GraphicsContext* ctx, int top, int height)
+{
+ // Note that since we haven't finished the current frame, the FPS counter
+ // actually reports the last frame's time.
+ double secForLastFrame = m_presentTimeHistoryInSec[(m_currentFrameNumber + kPresentHistorySize - 1) % kPresentHistorySize] -
+ m_presentTimeHistoryInSec[(m_currentFrameNumber + kPresentHistorySize - 2) % kPresentHistorySize];
+
+ // Filter the frame times to avoid spikes.
+ const float alpha = 0.1;
+ if (!m_filteredFrameTime) {
+ if (m_currentFrameNumber == 2)
+ m_filteredFrameTime = secForLastFrame;
+ } else
+ m_filteredFrameTime = ((1.0 - alpha) * m_filteredFrameTime) + (alpha * secForLastFrame);
+
+ // Create & measure FPS text.
+ String text(String::format("FPS: %5.1f", 1.0 / m_filteredFrameTime));
+ TextRun run(text);
+ float textWidth = m_mediumFont->width(run) + 2.0f;
+ float graphWidth = kPresentHistorySize;
+
+ // Draw background.
+ ctx->setFillColor(Color(0, 0, 0, 255), ColorSpaceDeviceRGB);
+ ctx->fillRect(FloatRect(2, top, textWidth + graphWidth, height));
+
+ // Draw FPS text.
+ if (m_filteredFrameTime) {
ctx->setFillColor(Color(255, 0, 0), ColorSpaceDeviceRGB);
- ctx->drawText(mediumFont, run, IntPoint(3, y));
- y = 26;
+ ctx->drawText(*m_mediumFont, run, IntPoint(3, top + height - 6));
}
- // Draw layer tree, if enabled.
- if (m_showPlatformLayerTree) {
- ctx->setFillColor(Color(255, 0, 0), ColorSpaceDeviceRGB);
- Vector<String> lines;
- m_layerRenderer->layerTreeAsText().split('\n', lines);
- for (size_t i = 0; i < lines.size(); ++i) {
- ctx->drawText(smallFont, TextRun(lines[i]), IntPoint(2, y));
- y += 12;
- }
+ // Draw FPS graph.
+ const double loFPS = 0.0;
+ const double hiFPS = 120.0;
+ ctx->setStrokeStyle(SolidStroke);
+ ctx->setStrokeColor(Color(255, 0, 0), ColorSpaceDeviceRGB);
+ int graphLeft = static_cast<int>(textWidth + 3);
+ IntPoint prev(-1, 0);
+ int x = 0;
+ double h = static_cast<double>(height - 2);
+ for (int i = m_currentFrameNumber % kPresentHistorySize; i != (m_currentFrameNumber - 1) % kPresentHistorySize; i = (i + 1) % kPresentHistorySize) {
+ int j = (i + 1) % kPresentHistorySize;
+ double fps = 1.0 / (m_presentTimeHistoryInSec[j] - m_presentTimeHistoryInSec[i]);
+ double p = 1 - ((fps - loFPS) / (hiFPS - loFPS));
+ if (p < 0)
+ p = 0;
+ if (p > 1)
+ p = 1;
+ IntPoint cur(graphLeft + x, 1 + top + p*h);
+ if (prev.x() != -1)
+ ctx->drawLine(prev, cur);
+ prev = cur;
+ x += 1;
+ }
+}
+
+void CCHeadsUpDisplay::drawPlatformLayerTree(GraphicsContext* ctx, int top)
+{
+ float smallFontHeight = m_smallFont->fontMetrics().floatHeight();
+ int y = top + smallFontHeight - 4;
+ ctx->setFillColor(Color(255, 0, 0), ColorSpaceDeviceRGB);
+ Vector<String> lines;
+ m_layerRenderer->layerTreeAsText().split('\n', lines);
+ for (size_t i = 0; i < lines.size(); ++i) {
+ ctx->drawText(*m_smallFont, TextRun(lines[i]), IntPoint(2, y));
+ y += smallFontHeight;
}
}
void CCHeadsUpDisplay::onPresent()
{
- m_presentTimeHistoryInSec[m_currentFrameNumber % 2] = currentTime();
+ m_presentTimeHistoryInSec[m_currentFrameNumber % kPresentHistorySize] = currentTime();
m_currentFrameNumber += 1;
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h
index d56f8ab..09f198a 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h
@@ -27,8 +27,10 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "Font.h"
#include "LayerRendererChromium.h"
+
namespace WebCore {
class GeometryBinding;
@@ -59,17 +61,26 @@ public:
private:
explicit CCHeadsUpDisplay(LayerRendererChromium* owner);
void drawHudContents(GraphicsContext*, const IntSize& hudSize);
+ void drawFPSCounter(GraphicsContext*, int top, int height);
+ void drawPlatformLayerTree(GraphicsContext*, int top);
+
int m_currentFrameNumber;
+ double m_filteredFrameTime;
+
OwnPtr<LayerTexture> m_hudTexture;
LayerRendererChromium* m_layerRenderer;
- double m_presentTimeHistoryInSec[2];
+ static const int kPresentHistorySize = 64;
+ double m_presentTimeHistoryInSec[kPresentHistorySize];
bool m_showFPSCounter;
bool m_showPlatformLayerTree;
+
+ OwnPtr<Font> m_smallFont;
+ OwnPtr<Font> m_mediumFont;
};
}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
index 9411e5a..e2d651d 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
@@ -126,12 +126,12 @@ bool CCLayerImpl::descendantsDrawsContent()
// These belong on CCLayerImpl, but should be overridden by each type and not defer to the LayerChromium subtypes.
bool CCLayerImpl::drawsContent() const
{
- return m_owner->drawsContent();
+ return m_owner && m_owner->drawsContent();
}
-void CCLayerImpl::draw()
+void CCLayerImpl::draw(const IntRect& targetSurfaceRect)
{
- return m_owner->draw();
+ return m_owner->draw(targetSurfaceRect);
}
void CCLayerImpl::updateCompositorResources()
@@ -215,4 +215,3 @@ void CCLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
}
#endif // USE(ACCELERATED_COMPOSITING)
-
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
index 96c4f1b..649f4dd 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
@@ -50,6 +50,7 @@ public:
}
// When this class gets subclasses, remember to add 'virtual' here.
virtual ~CCLayerImpl();
+ void resetOwner() { m_owner = 0; }
#ifndef NDEBUG
int debugID() const { return m_debugID; }
@@ -59,7 +60,7 @@ public:
CCLayerImpl* maskLayer() const;
CCLayerImpl* replicaLayer() const;
- virtual void draw();
+ virtual void draw(const IntRect& contentRect);
virtual void updateCompositorResources();
void unreserveContentsTexture();
void bindContentsTexture();
@@ -205,4 +206,3 @@ private:
}
#endif // CCLayerImpl_h
-
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.cpp
new file mode 100644
index 0000000..cd36817
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.cpp
@@ -0,0 +1,46 @@
+/*
+ * 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 INC. 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 INC. 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 "CCMainThread.h"
+
+#include <wtf/MainThread.h>
+
+using namespace WTF;
+
+namespace WebCore {
+
+void CCMainThread::performTask(void* userdata)
+{
+ Task* task = static_cast<Task*>(userdata);
+ task->performTask();
+ delete task;
+}
+
+void CCMainThread::postTask(PassOwnPtr<Task> task)
+{
+ callOnMainThread(performTask, task.leakPtr());
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h b/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h
new file mode 100644
index 0000000..ca8e8c1
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCMainThread.h
@@ -0,0 +1,53 @@
+/*
+ * 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 INC. 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 INC. 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.
+ */
+#ifndef CCMainThread_h
+#define CCMainThread_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+// Task wrapper around WTF::callOnMainThreadThread
+class CCMainThread {
+public:
+ class Task {
+ WTF_MAKE_NONCOPYABLE(Task);
+ public:
+ virtual ~Task() { }
+ virtual void performTask() = 0;
+ void* instance() const { return m_instance; }
+ protected:
+ Task(void* instance) : m_instance(instance) { }
+ void* m_instance;
+ };
+
+ static void postTask(PassOwnPtr<Task>); // Executes the task on main thread asynchronously.
+private:
+ static void performTask(void*);
+};
+
+} // namespace WebCore
+
+#endif // CCMainThread_h
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCMainThreadTask.h b/Source/WebCore/platform/graphics/chromium/cc/CCMainThreadTask.h
new file mode 100644
index 0000000..7de8d71
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCMainThreadTask.h
@@ -0,0 +1,220 @@
+/*
+ * 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 INC. 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 INC. 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.
+ */
+#ifndef CCMainThreadTask_h
+#define CCMainThreadTask_h
+
+#include "CCMainThread.h"
+#include "CrossThreadCopier.h"
+#include "CrossThreadTask.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+template<typename T>
+class MainThreadTask0 : public CCMainThread::Task {
+public:
+ typedef void (T::*Method)();
+ typedef MainThreadTask0<T> MainThreadTaskImpl;
+
+ static PassOwnPtr<MainThreadTaskImpl> create(T* instance, Method method)
+ {
+ return adoptPtr(new MainThreadTaskImpl(instance, method));
+ }
+
+private:
+ MainThreadTask0(T* instance, Method method)
+ : CCMainThread::Task(instance)
+ , m_method(method)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)();
+ }
+
+private:
+ Method m_method;
+};
+
+template<typename T, typename P1, typename MP1>
+class MainThreadTask1 : public CCMainThread::Task {
+public:
+ typedef void (T::*Method)(MP1);
+ typedef MainThreadTask1<T, P1, MP1> MainThreadTaskImpl;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+
+ static PassOwnPtr<MainThreadTaskImpl> create(T* instance, Method method, Param1 parameter1)
+ {
+ return adoptPtr(new MainThreadTaskImpl(instance, method, parameter1));
+ }
+
+private:
+ MainThreadTask1(T* instance, Method method, Param1 parameter1)
+ : CCMainThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+};
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2>
+class MainThreadTask2 : public CCMainThread::Task {
+public:
+ typedef void (T::*Method)(MP1, MP2);
+ typedef MainThreadTask2<T, P1, MP1, P2, MP2> MainThreadTaskImpl;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+
+ static PassOwnPtr<MainThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2)
+ {
+ return adoptPtr(new MainThreadTaskImpl(instance, method, parameter1, parameter2));
+ }
+
+private:
+ MainThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2)
+ : CCMainThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+};
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
+class MainThreadTask3 : public CCMainThread::Task {
+public:
+ typedef void (T::*Method)(MP1, MP2, MP3);
+ typedef MainThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> MainThreadTaskImpl;
+ typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
+ typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
+ typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
+
+ static PassOwnPtr<MainThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
+ {
+ return adoptPtr(new MainThreadTaskImpl(instance, method, parameter1, parameter2, parameter3));
+ }
+
+private:
+ MainThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
+ : CCMainThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+};
+
+template<typename T>
+PassOwnPtr<CCMainThread::Task> createMainThreadTask(
+ T* const callee,
+ void (T::*method)());
+
+template<typename T>
+PassOwnPtr<CCMainThread::Task> createMainThreadTask(
+ T* const callee,
+ void (T::*method)())
+{
+ return MainThreadTask0<T>::create(
+ callee,
+ method);
+}
+
+template<typename T, typename P1, typename MP1>
+PassOwnPtr<CCMainThread::Task> createMainThreadTask(
+ T* const callee,
+ void (T::*method)(MP1),
+ const P1& parameter1)
+{
+ return MainThreadTask1<T, typename CrossThreadCopier<P1>::Type, MP1>::create(
+ callee,
+ method,
+ CrossThreadCopier<P1>::copy(parameter1));
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2>
+PassOwnPtr<CCMainThread::Task> createMainThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2),
+ const P1& parameter1,
+ const P2& parameter2)
+{
+ return MainThreadTask2<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
+ callee,
+ method,
+ CrossThreadCopier<P1>::copy(parameter1),
+ CrossThreadCopier<P2>::copy(parameter2));
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
+PassOwnPtr<CCMainThread::Task> createMainThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2, MP3),
+ const P1& parameter1,
+ const P2& parameter2,
+ const P3& parameter3)
+{
+ return MainThreadTask3<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create(
+ callee,
+ method,
+ CrossThreadCopier<P1>::copy(parameter1),
+ CrossThreadCopier<P2>::copy(parameter2),
+ CrossThreadCopier<P3>::copy(parameter3));
+}
+
+} // namespace WebCore
+
+#endif // CCMainThreadTask_h
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp
index 4aef639..a428829 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp
@@ -46,7 +46,7 @@ CCPluginLayerImpl::~CCPluginLayerImpl()
{
}
-void CCPluginLayerImpl::draw()
+void CCPluginLayerImpl::draw(const IntRect&)
{
ASSERT(layerRenderer());
const CCPluginLayerImpl::Program* program = layerRenderer()->pluginLayerProgram();
@@ -81,4 +81,3 @@ void CCPluginLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
}
#endif // USE(ACCELERATED_COMPOSITING)
-
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h
index 65eb5b7..4fd7457 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h
@@ -42,7 +42,7 @@ public:
typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexFlipAlpha> Program;
- virtual void draw();
+ virtual void draw(const IntRect&);
virtual void dumpLayerProperties(TextStream&, int indent) const;
@@ -57,4 +57,3 @@ private:
}
#endif // CCPluginLayerImpl_h
-
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThread.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThread.cpp
new file mode 100644
index 0000000..9566584
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThread.cpp
@@ -0,0 +1,79 @@
+/*
+ * 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 INC. 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 INC. 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 "CCThread.h"
+
+#include "LayerRendererChromium.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/ThreadingPrimitives.h>
+
+namespace WebCore {
+
+using namespace WTF;
+
+CCThread::CCThread()
+{
+ MutexLocker lock(m_threadCreationMutex);
+ m_threadID = createThread(CCThread::compositorThreadStart, this, "Chromium Compositor");
+}
+
+CCThread::~CCThread()
+{
+ m_queue.kill();
+
+ // Stop thread.
+ void* exitCode;
+ waitForThreadCompletion(m_threadID, &exitCode);
+ m_threadID = 0;
+}
+
+void CCThread::postTask(PassOwnPtr<Task> task)
+{
+ m_queue.append(task);
+}
+
+void* CCThread::compositorThreadStart(void* userdata)
+{
+ CCThread* ccThread = static_cast<CCThread*>(userdata);
+ return ccThread->runLoop();
+}
+
+void* CCThread::runLoop()
+{
+ {
+ // Wait for CCThread::start() to complete to have m_threadID
+ // established before starting the main loop.
+ MutexLocker lock(m_threadCreationMutex);
+ }
+
+ while (OwnPtr<Task> task = m_queue.waitForMessage())
+ task->performTask();
+
+ return 0;
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThread.h b/Source/WebCore/platform/graphics/chromium/cc/CCThread.h
new file mode 100644
index 0000000..177d3f3
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThread.h
@@ -0,0 +1,75 @@
+/*
+ * 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 INC. 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 INC. 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.
+ */
+
+#ifndef CCThread_h
+#define CCThread_h
+
+#include <wtf/MessageQueue.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+// The CCThread singleton owns the compositor thread and provides
+// basic infrastructure for messaging between the two threads.
+class CCThread {
+public:
+ static PassOwnPtr<CCThread> create()
+ {
+ return adoptPtr(new CCThread());
+ }
+
+ virtual ~CCThread();
+
+ class Task {
+ WTF_MAKE_NONCOPYABLE(Task);
+ public:
+ virtual ~Task() { }
+ virtual void performTask() = 0;
+ void* instance() const { return m_instance; }
+ protected:
+ Task(void* instance) : m_instance(instance) { }
+ void* m_instance;
+ };
+
+ void postTask(PassOwnPtr<Task>); // Executes the task on context's thread asynchronously.
+
+ WTF::ThreadIdentifier threadID() const { return m_threadID; }
+
+protected:
+ explicit CCThread();
+
+ static void* compositorThreadStart(void*);
+ void* runLoop();
+
+ WTF::ThreadIdentifier m_threadID;
+ MessageQueue<Task> m_queue;
+
+ Mutex m_threadCreationMutex;
+};
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadTask.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadTask.h
new file mode 100644
index 0000000..71245d3
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadTask.h
@@ -0,0 +1,279 @@
+/*
+ * 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 INC. 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 INC. 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.
+ */
+#ifndef CCThreadTask_h
+#define CCThreadTask_h
+
+#include "CCThread.h"
+#include "CrossThreadCopier.h"
+#include "CrossThreadTask.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+template<typename T>
+class CCThreadTask0 : public CCThread::Task {
+public:
+ typedef void (T::*Method)();
+ typedef CCThreadTask0<T> CCThreadTaskImpl;
+
+ static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method));
+ }
+
+private:
+ CCThreadTask0(T* instance, Method method)
+ : CCThread::Task(instance)
+ , m_method(method)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)();
+ }
+
+private:
+ Method m_method;
+};
+
+template<typename T, typename P1, typename MP1>
+class CCThreadTask1 : public CCThread::Task {
+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)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1));
+ }
+
+private:
+ CCThreadTask1(T* instance, Method method, Param1 parameter1)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+};
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2>
+class CCThreadTask2 : public CCThread::Task {
+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)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2));
+ }
+
+private:
+ CCThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+};
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
+class CCThreadTask3 : public CCThread::Task {
+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)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3));
+ }
+
+private:
+ CCThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+};
+
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
+class CCThreadTask4 : public CCThread::Task {
+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)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4));
+ }
+
+private:
+ CCThreadTask4(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ , m_parameter4(parameter4)
+ {
+ }
+
+ virtual void performTask()
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3, m_parameter4);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+ P4 m_parameter4;
+};
+
+template<typename T>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)());
+
+template<typename T>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)())
+{
+ return CCThreadTask0<T>::create(
+ callee,
+ method);
+}
+
+template<typename T, typename P1, typename MP1>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1),
+ const P1& parameter1)
+{
+ return CCThreadTask1<T, typename CrossThreadCopier<P1>::Type, MP1>::create(
+ callee,
+ method,
+ CrossThreadCopier<P1>::copy(parameter1));
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2),
+ const P1& parameter1,
+ const P2& parameter2)
+{
+ return CCThreadTask2<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
+ callee,
+ method,
+ CrossThreadCopier<P1>::copy(parameter1),
+ CrossThreadCopier<P2>::copy(parameter2));
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2, MP3),
+ const P1& parameter1,
+ 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(
+ callee,
+ method,
+ CrossThreadCopier<P1>::copy(parameter1),
+ CrossThreadCopier<P2>::copy(parameter2),
+ CrossThreadCopier<P3>::copy(parameter3));
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2, MP3, MP4),
+ const P1& parameter1,
+ const P2& parameter2,
+ 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(
+ callee,
+ method,
+ CrossThreadCopier<P1>::copy(parameter1),
+ CrossThreadCopier<P2>::copy(parameter2),
+ CrossThreadCopier<P3>::copy(parameter3),
+ CrossThreadCopier<P4>::copy(parameter4));
+
+}
+
+} // namespace WebCore
+
+#endif // CCThreadTask_h
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
index eb3612b..99a148d 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
@@ -75,7 +75,7 @@ void CCVideoLayerImpl::setTexture(size_t i, VideoLayerChromium::Texture texture)
m_textures[i] = texture;
}
-void CCVideoLayerImpl::draw()
+void CCVideoLayerImpl::draw(const IntRect&)
{
if (m_skipsDraw)
return;
@@ -170,4 +170,3 @@ void CCVideoLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
}
#endif // USE(ACCELERATED_COMPOSITING)
-
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h
index 62f8778..0e1d1f6 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h
@@ -47,7 +47,7 @@ public:
typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexFlipAlpha> RGBAProgram;
typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVVideo> YUVProgram;
- virtual void draw();
+ virtual void draw(const IntRect&);
virtual void dumpLayerProperties(TextStream&, int indent) const;
@@ -72,4 +72,3 @@ private:
}
#endif // CCVideoLayerImpl_h
-