summaryrefslogtreecommitdiffstats
path: root/webkit
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
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')
-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
-rw-r--r--webkit/glue/webkit_glue.gypi9
-rw-r--r--webkit/glue/webkitplatformsupport_impl.cc8
-rw-r--r--webkit/glue/webkitplatformsupport_impl.h3
6 files changed, 286 insertions, 2 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_
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 6c7a448..4385667 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -11,6 +11,8 @@
'webkit_src_dir': '../../third_party/WebKit',
}],
],
+
+ 'use_libcc_for_compositor%': 0,
},
'target_defaults': {
# Disable narrowing-conversion-in-initialization-list warnings in that we
@@ -140,6 +142,7 @@
'<(DEPTH)/ui/gl/gl.gyp:gl',
'<(DEPTH)/ui/ui.gyp:ui',
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
+ '<(DEPTH)/webkit/compositor_bindings/compositor_bindings.gyp:webkit_compositor_support',
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
'blob',
'fileapi',
@@ -520,6 +523,7 @@
'sources!': [
'plugins/plugin_stubs.cc',
],
+ 'msvs_disabled_warnings': [ 4800 ],
'conditions': [
['inside_chromium_build==1 and component=="shared_library"', {
'dependencies': [
@@ -537,6 +541,11 @@
'<(DEPTH)/webkit/support/setup_third_party.gyp:third_party_headers',
],
}],
+ ['use_libcc_for_compositor==1', {
+ 'defines': [
+ 'USE_LIBCC_FOR_COMPOSITOR',
+ ],
+ }],
],
},
],
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index 8cc850a..6083d0f 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -39,6 +39,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
#include "ui/base/layout.h"
+#include "webkit/compositor_bindings/web_compositor_support_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/websocketstreamhandle_impl.h"
#include "webkit/glue/webthread_impl.h"
@@ -233,7 +234,8 @@ WebKitPlatformSupportImpl::WebKitPlatformSupportImpl()
shared_timer_func_(NULL),
shared_timer_fire_time_(0.0),
shared_timer_suspended_(0),
- current_thread_slot_(&DestroyCurrentThread) {
+ current_thread_slot_(&DestroyCurrentThread),
+ compositor_support_(new webkit::WebCompositorSupportImpl) {
}
WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
@@ -652,6 +654,10 @@ WebKit::WebThread* WebKitPlatformSupportImpl::currentThread() {
return thread;
}
+WebKit::WebCompositorSupport* WebKitPlatformSupportImpl::compositorSupport() {
+ return compositor_support_.get();
+}
+
base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile(
const WebKit::WebString& vfs_file_name, int desired_flags) {
return base::kInvalidPlatformFileValue;
diff --git a/webkit/glue/webkitplatformsupport_impl.h b/webkit/glue/webkitplatformsupport_impl.h
index 59dc97e..aa8eed6 100644
--- a/webkit/glue/webkitplatformsupport_impl.h
+++ b/webkit/glue/webkitplatformsupport_impl.h
@@ -28,6 +28,7 @@
class MessageLoop;
namespace webkit {
+class WebCompositorSupportImpl;
struct WebPluginInfo;
}
@@ -119,6 +120,7 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
virtual void callOnMainThread(void (*func)(void*), void* context);
virtual WebKit::WebThread* createThread(const char* name);
virtual WebKit::WebThread* currentThread();
+ virtual WebKit::WebCompositorSupport* compositorSupport();
// Embedder functions. The following are not implemented by the glue layer and
@@ -171,6 +173,7 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
int shared_timer_suspended_; // counter
WebThemeEngineImpl theme_engine_;
base::ThreadLocalStorage::Slot current_thread_slot_;
+ scoped_ptr<webkit::WebCompositorSupportImpl> compositor_support_;
};
} // namespace webkit_glue