summaryrefslogtreecommitdiffstats
path: root/webkit/compositor_bindings
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-04 21:52:43 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-04 21:52:43 +0000
commitfbed741ffa21ff80b71eeb9dc2daa9ad5945e244 (patch)
tree688e81450749e36513de2bb30192f6e470e57ac3 /webkit/compositor_bindings
parent9d114592cf62fb783f59874ee4b4b04ec78f4652 (diff)
downloadchromium_src-fbed741ffa21ff80b71eeb9dc2daa9ad5945e244.zip
chromium_src-fbed741ffa21ff80b71eeb9dc2daa9ad5945e244.tar.gz
chromium_src-fbed741ffa21ff80b71eeb9dc2daa9ad5945e244.tar.bz2
Implementation of WebCompositorSupport when use_libcc_for_compositor=1
Review URL: https://chromiumcodereview.appspot.com/10918037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/compositor_bindings')
-rw-r--r--webkit/compositor_bindings/compositor_bindings.gyp40
-rw-r--r--webkit/compositor_bindings/web_compositor_support_impl.cc178
-rw-r--r--webkit/compositor_bindings/web_compositor_support_impl.h50
3 files changed, 267 insertions, 1 deletions
diff --git a/webkit/compositor_bindings/compositor_bindings.gyp b/webkit/compositor_bindings/compositor_bindings.gyp
index 5536de0..77f2705 100644
--- a/webkit/compositor_bindings/compositor_bindings.gyp
+++ b/webkit/compositor_bindings/compositor_bindings.gyp
@@ -44,7 +44,45 @@
'WebVideoLayerImpl.h',
'WheelFlingPlatformGestureCurve.h',
],
+ 'conditions': [
+ ['inside_chromium_build==0', {
+ 'webkit_src_dir': '../../../../..',
+ },{
+ 'webkit_src_dir': '../../third_party/WebKit',
+ }],
+ ],
+
+
},
+ 'targets': [
+ {
+ 'target_name': 'webkit_compositor_support',
+ 'type': 'static_library',
+ 'dependencies': [
+ '../../skia/skia.gyp:skia',
+ ],
+ 'sources': [
+ 'web_compositor_support_impl.cc',
+ 'web_compositor_support_impl.h',
+ ],
+ 'include_dirs': [
+ '../..',
+ '<(webkit_src_dir)/Source/Platform/chromium',
+ ],
+ 'conditions': [
+ ['use_libcc_for_compositor==1', {
+ 'include_dirs': [
+ '../../cc',
+ '../../cc/stubs',
+ ],
+ 'dependencies': [
+ 'webkit_compositor_bindings',
+ '../../third_party/WebKit/Source/WTF/WTF.gyp/WTF.gyp:wtf',
+ ],
+ }],
+ ],
+ },
+ ],
'conditions': [
['use_libcc_for_compositor==1', {
'targets': [
@@ -73,7 +111,7 @@
'stubs/AnimationIdVendor.h',
'stubs/public/WebTransformationMatrix',
],
- }
+ },
],
}],
],
diff --git a/webkit/compositor_bindings/web_compositor_support_impl.cc b/webkit/compositor_bindings/web_compositor_support_impl.cc
new file mode 100644
index 0000000..0716143
--- /dev/null
+++ b/webkit/compositor_bindings/web_compositor_support_impl.cc
@@ -0,0 +1,178 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/compositor_bindings/web_compositor_support_impl.h"
+
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+#include "webkit/compositor_bindings/WebLayerImpl.h"
+#include "webkit/compositor_bindings/WebLayerTreeViewImpl.h"
+#include "webkit/compositor_bindings/WebContentLayerImpl.h"
+#include "webkit/compositor_bindings/WebExternalTextureLayerImpl.h"
+#include "webkit/compositor_bindings/WebIOSurfaceLayerImpl.h"
+#include "webkit/compositor_bindings/WebSolidColorLayerImpl.h"
+#include "webkit/compositor_bindings/WebImageLayerImpl.h"
+#include "webkit/compositor_bindings/WebVideoLayerImpl.h"
+#include "webkit/compositor_bindings/WebScrollbarLayerImpl.h"
+#include "webkit/compositor_bindings/WebAnimationImpl.h"
+#include "webkit/compositor_bindings/WebFloatAnimationCurveImpl.h"
+#include "webkit/compositor_bindings/WebTransformAnimationCurveImpl.h"
+#else
+#include "third_party/WebKit/Source/Platform/chromium/public/WebAnimation.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatAnimationCurve.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebIOSurfaceLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebImageLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformAnimationCurve.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebVideoLayer.h"
+#endif
+
+using WebKit::WebAnimation;
+using WebKit::WebAnimationCurve;
+using WebKit::WebContentLayer;
+using WebKit::WebContentLayerClient;
+using WebKit::WebExternalTextureLayer;
+using WebKit::WebExternalTextureLayerClient;
+using WebKit::WebFloatAnimationCurve;
+using WebKit::WebIOSurfaceLayer;
+using WebKit::WebImageLayer;
+using WebKit::WebImageLayer;
+using WebKit::WebLayer;
+using WebKit::WebLayerTreeView;
+using WebKit::WebLayerTreeViewClient;
+using WebKit::WebScrollbar;
+using WebKit::WebScrollbarLayer;
+using WebKit::WebScrollbarThemeGeometry;
+using WebKit::WebScrollbarThemePainter;
+using WebKit::WebSolidColorLayer;
+using WebKit::WebTransformAnimationCurve;
+using WebKit::WebVideoFrameProvider;
+using WebKit::WebVideoLayer;
+
+namespace webkit {
+
+WebCompositorSupportImpl::WebCompositorSupportImpl() {
+}
+
+WebCompositorSupportImpl::~WebCompositorSupportImpl() {
+}
+
+WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView(
+ WebLayerTreeViewClient* client, const WebLayer& root,
+ const WebLayerTreeView::Settings& settings) {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl(
+ new WebKit::WebLayerTreeViewImpl(client));
+ if (!layerTreeViewImpl->initialize(settings))
+ return NULL;
+ layerTreeViewImpl->setRootLayer(root);
+ return layerTreeViewImpl.release();
+#else
+ return WebLayerTreeView::create(client, root, settings);
+#endif
+}
+
+WebLayer* WebCompositorSupportImpl::createLayer() {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebLayerImpl();
+#else
+ return WebLayer::create();
+#endif
+}
+
+WebContentLayer* WebCompositorSupportImpl::createContentLayer(
+ WebContentLayerClient* client) {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebContentLayerImpl(client);
+#else
+ return WebKit::WebContentLayer::create(client);
+#endif
+}
+
+WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer(
+ WebExternalTextureLayerClient* client) {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebExternalTextureLayerImpl(client);
+#else
+ return WebKit::WebExternalTextureLayer::create(client);
+#endif
+}
+
+WebKit::WebIOSurfaceLayer*
+ WebCompositorSupportImpl::createIOSurfaceLayer() {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebIOSurfaceLayerImpl();
+#else
+ return WebKit::WebIOSurfaceLayer::create();
+#endif
+}
+
+WebKit::WebImageLayer* WebCompositorSupportImpl::createImageLayer() {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebImageLayerImpl();
+#else
+ return WebKit::WebImageLayer::create();
+#endif
+}
+
+WebSolidColorLayer* WebCompositorSupportImpl::createSolidColorLayer() {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebSolidColorLayerImpl();
+#else
+ return WebKit::WebSolidColorLayer::create();
+#endif
+}
+
+WebVideoLayer* WebCompositorSupportImpl::createVideoLayer(
+ WebKit::WebVideoFrameProvider* provider) {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebVideoLayerImpl(provider);
+#else
+ return WebKit::WebVideoLayer::create(provider);
+#endif
+}
+
+WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer(
+ WebScrollbar* scrollbar,
+ WebScrollbarThemePainter painter,
+ WebScrollbarThemeGeometry* geometry) {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebScrollbarLayerImpl(scrollbar, painter, geometry);
+#else
+ return WebKit::WebScrollbarLayer::create(scrollbar, painter, geometry);
+#endif
+}
+
+WebAnimation* WebCompositorSupportImpl::createAnimation(
+ const WebKit::WebAnimationCurve& curve,
+ WebKit::WebAnimation::TargetProperty target,
+ int animationId) {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebAnimationImpl(curve, target, animationId);
+#else
+ return WebKit::WebAnimation::create(curve, target, animationId);
+#endif
+}
+
+WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebFloatAnimationCurveImpl();
+#else
+ return WebKit::WebFloatAnimationCurve::create();
+#endif
+}
+
+WebTransformAnimationCurve*
+ WebCompositorSupportImpl::createTransformAnimationCurve() {
+#if defined(USE_LIBCC_FOR_COMPOSITOR)
+ return new WebKit::WebTransformAnimationCurveImpl();
+#else
+ return WebKit::WebTransformAnimationCurve::create();
+#endif
+}
+
+} // namespace webkit
diff --git a/webkit/compositor_bindings/web_compositor_support_impl.h b/webkit/compositor_bindings/web_compositor_support_impl.h
new file mode 100644
index 0000000..6b04938
--- /dev/null
+++ b/webkit/compositor_bindings/web_compositor_support_impl.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_IMPL_H_
+#define WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_IMPL_H_
+
+#include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSupport.h"
+
+namespace webkit {
+
+class WebCompositorSupportImpl : public WebKit::WebCompositorSupport {
+ public:
+ WebCompositorSupportImpl();
+ virtual ~WebCompositorSupportImpl();
+
+ virtual WebKit::WebLayerTreeView* createLayerTreeView(
+ WebKit::WebLayerTreeViewClient* client, const WebKit::WebLayer& root,
+ const WebKit::WebLayerTreeView::Settings& settings);
+
+ virtual WebKit::WebLayer* createLayer();
+ virtual WebKit::WebContentLayer* createContentLayer(
+ WebKit::WebContentLayerClient* client);
+ virtual WebKit::WebExternalTextureLayer*
+ createExternalTextureLayer(WebKit::WebExternalTextureLayerClient* client);
+ virtual WebKit::WebIOSurfaceLayer*
+ createIOSurfaceLayer();
+ virtual WebKit::WebImageLayer* createImageLayer();
+ virtual WebKit::WebSolidColorLayer*
+ createSolidColorLayer();
+ virtual WebKit::WebVideoLayer*
+ createVideoLayer(WebKit::WebVideoFrameProvider*);
+ virtual WebKit::WebScrollbarLayer* createScrollbarLayer(
+ WebKit::WebScrollbar* scrollbar,
+ WebKit::WebScrollbarThemePainter painter,
+ WebKit::WebScrollbarThemeGeometry*);
+ virtual WebKit::WebAnimation* createAnimation(
+ const WebKit::WebAnimationCurve& curve,
+ WebKit::WebAnimation::TargetProperty target,
+ int animationId);
+ virtual WebKit::WebFloatAnimationCurve*
+ createFloatAnimationCurve();
+ virtual WebKit::WebTransformAnimationCurve*
+ createTransformAnimationCurve();
+};
+
+} // namespace webkit
+
+#endif // WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_IMPL_H_