diff options
author | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 23:05:52 +0000 |
---|---|---|
committer | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 23:05:52 +0000 |
commit | 4ef39e9b974e78b9cfabe4db2a7aab7da9333a98 (patch) | |
tree | 8faebe2144cc01e266449b96b5d9237bcf8ee8fc /ui | |
parent | 7f3c7afde3b300f5fc922493d494f9a9f6c36c0d (diff) | |
download | chromium_src-4ef39e9b974e78b9cfabe4db2a7aab7da9333a98.zip chromium_src-4ef39e9b974e78b9cfabe4db2a7aab7da9333a98.tar.gz chromium_src-4ef39e9b974e78b9cfabe4db2a7aab7da9333a98.tar.bz2 |
Revert 106606 - Use WebKit compositor in ui::Layer
BUG=99524
TEST=compositor_unittests
Review URL: http://codereview.chromium.org/8222028
TBR=piman@chromium.org
Review URL: http://codereview.chromium.org/8360018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/aura.gyp | 1 | ||||
-rw-r--r-- | ui/aura/test/test_suite.cc | 3 | ||||
-rw-r--r-- | ui/aura_shell/aura_shell.gyp | 2 | ||||
-rw-r--r-- | ui/aura_shell/examples/aura_shell_main.cc | 4 | ||||
-rw-r--r-- | ui/aura_shell/test_suite.cc | 3 | ||||
-rw-r--r-- | ui/gfx/compositor/DEPS | 7 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor.cc | 15 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor.gyp | 37 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor.h | 6 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_cc.cc | 125 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_cc.h | 82 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_test_support.cc | 35 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_test_support.h | 19 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.cc | 114 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.h | 29 | ||||
-rw-r--r-- | ui/gfx/compositor/layer_unittest.cc | 104 | ||||
-rw-r--r-- | ui/gfx/compositor/test_compositor.cc | 6 | ||||
-rw-r--r-- | ui/gfx/compositor/test_compositor.h | 1 | ||||
-rw-r--r-- | ui/gfx/compositor/test_compositor_host_linux.cc | 3 | ||||
-rw-r--r-- | ui/gfx/compositor/test_suite.cc | 15 | ||||
-rw-r--r-- | ui/gfx/compositor/test_suite.h | 11 |
21 files changed, 51 insertions, 571 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index e5053f3..828227b 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -83,7 +83,6 @@ '../../skia/skia.gyp:skia', '../../testing/gtest.gyp:gtest', '../gfx/compositor/compositor.gyp:compositor', - '../gfx/compositor/compositor.gyp:compositor_test_support', '../gfx/gl/gl.gyp:gl', '../ui.gyp:gfx_resources', '../ui.gyp:ui', diff --git a/ui/aura/test/test_suite.cc b/ui/aura/test/test_suite.cc index 11e0f3b..b1b371b 100644 --- a/ui/aura/test/test_suite.cc +++ b/ui/aura/test/test_suite.cc @@ -9,7 +9,6 @@ #include "build/build_config.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" -#include "ui/gfx/compositor/compositor_test_support.h" #include "ui/gfx/gfx_paths.h" #include "ui/gfx/gl/gl_implementation.h" @@ -28,11 +27,9 @@ void AuraTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstance("en-US"); - ui::CompositorTestSupport::Initialize(); } void AuraTestSuite::Shutdown() { - ui::CompositorTestSupport::Terminate(); ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); diff --git a/ui/aura_shell/aura_shell.gyp b/ui/aura_shell/aura_shell.gyp index 8fef1ec..637534b 100644 --- a/ui/aura_shell/aura_shell.gyp +++ b/ui/aura_shell/aura_shell.gyp @@ -73,7 +73,6 @@ '../../third_party/icu/icu.gyp:icuuc', '../../views/views.gyp:views', '../gfx/compositor/compositor.gyp:compositor', - '../gfx/compositor/compositor.gyp:compositor_test_support', '../ui.gyp:gfx_resources', '../ui.gyp:ui', '../ui.gyp:ui_resources', @@ -111,7 +110,6 @@ '../../views/views.gyp:views', '../aura/aura.gyp:aura', '../gfx/compositor/compositor.gyp:compositor', - '../gfx/compositor/compositor.gyp:compositor_test_support', '../ui.gyp:gfx_resources', '../ui.gyp:ui', '../ui.gyp:ui_resources', diff --git a/ui/aura_shell/examples/aura_shell_main.cc b/ui/aura_shell/examples/aura_shell_main.cc index 414bcdd..486554b 100644 --- a/ui/aura_shell/examples/aura_shell_main.cc +++ b/ui/aura_shell/examples/aura_shell_main.cc @@ -15,7 +15,6 @@ #include "ui/aura_shell/shell_factory.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" -#include "ui/gfx/compositor/compositor_test_support.h" namespace { @@ -70,7 +69,6 @@ int main(int argc, char** argv) { // Create the message-loop here before creating the desktop. MessageLoop message_loop(MessageLoop::TYPE_UI); - ui::CompositorTestSupport::Initialize(); aura_shell::Shell::GetInstance()->SetDelegate(new ShellDelegateImpl);; @@ -80,8 +78,6 @@ int main(int argc, char** argv) { delete aura::Desktop::GetInstance(); - ui::CompositorTestSupport::Terminate(); - return 0; } diff --git a/ui/aura_shell/test_suite.cc b/ui/aura_shell/test_suite.cc index 5ccb18f..2652a24 100644 --- a/ui/aura_shell/test_suite.cc +++ b/ui/aura_shell/test_suite.cc @@ -9,7 +9,6 @@ #include "build/build_config.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" -#include "ui/gfx/compositor/compositor_test_support.h" #include "ui/gfx/gfx_paths.h" #include "ui/gfx/gl/gl_implementation.h" @@ -28,11 +27,9 @@ void AuraShellTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstance("en-US"); - ui::CompositorTestSupport::Initialize(); } void AuraShellTestSuite::Shutdown() { - ui::CompositorTestSupport::Terminate(); ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); diff --git a/ui/gfx/compositor/DEPS b/ui/gfx/compositor/DEPS deleted file mode 100644 index 956b453..0000000 --- a/ui/gfx/compositor/DEPS +++ /dev/null @@ -1,7 +0,0 @@ -# NOTE(piman): This is not an invitation to add WebKit stuff in general into -# the compositor/ui. These lines will disappear once we can extract the Chromium -# Compositor out of WebKit. -include_rules = [ - "+webkit/glue", - "+webkit/gpu", -] diff --git a/ui/gfx/compositor/compositor.cc b/ui/gfx/compositor/compositor.cc index 87aa06e..6f7e5db 100644 --- a/ui/gfx/compositor/compositor.cc +++ b/ui/gfx/compositor/compositor.cc @@ -25,15 +25,10 @@ Compositor::Compositor(CompositorDelegate* delegate, const gfx::Size& size) Compositor::~Compositor() { } -void Compositor::ScheduleDraw() { - delegate_->ScheduleDraw(); -} - void Compositor::SetRootLayer(Layer* root_layer) { root_layer_ = root_layer; if (!root_layer_->GetCompositor()) root_layer_->SetCompositor(this); - OnRootLayerChanged(); } void Compositor::Draw(bool force_clear) { @@ -41,7 +36,7 @@ void Compositor::Draw(bool force_clear) { return; NotifyStart(force_clear); - DrawTree(); + root_layer_->DrawTree(); NotifyEnd(); } @@ -57,14 +52,6 @@ bool Compositor::HasObserver(CompositorObserver* observer) { return observer_list_.HasObserver(observer); } -void Compositor::OnRootLayerChanged() { - ScheduleDraw(); -} - -void Compositor::DrawTree() { - root_layer_->DrawTree(); -} - void Compositor::NotifyStart(bool clear) { OnNotifyStart(clear); } diff --git a/ui/gfx/compositor/compositor.gyp b/ui/gfx/compositor/compositor.gyp index 0e94f3e..d5e38b7 100644 --- a/ui/gfx/compositor/compositor.gyp +++ b/ui/gfx/compositor/compositor.gyp @@ -29,7 +29,6 @@ '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/ui/gfx/gl/gl.gyp:gl', '<(DEPTH)/ui/ui.gyp:ui', - '<(DEPTH)/third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', ], 'defines': [ 'COMPOSITOR_IMPLEMENTATION', @@ -40,8 +39,6 @@ 'compositor_export.h', 'compositor_gl.cc', 'compositor_gl.h', - 'compositor_cc.cc', - 'compositor_cc.h', 'compositor_observer.h', 'compositor_stub.cc', 'compositor_win.cc', @@ -80,39 +77,6 @@ ['exclude', '^compositor_win.cc'], ], }], - ['use_webkit_compositor == 1', { - 'sources/': [ - ['exclude', '^compositor_(gl|win|stub).(h|cc)$'], - ], - 'dependencies': [ - '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_gpu', - ], - }, { - 'sources!': [ - 'compositor_cc.cc', - 'compositor_cc.h', - ], - } - ], - ], - }, - { - 'target_name': 'compositor_test_support', - 'type': '<(component)', - 'dependencies': [ - '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_support', - '<(DEPTH)/third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', - ], - 'sources': [ - 'compositor_test_support.cc', - 'compositor_test_support.h', - ], - 'conditions': [ - ['use_webkit_compositor == 1', { - 'dependencies': [ - '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_support', - ], - }], ], }, { @@ -128,7 +92,6 @@ '<(DEPTH)/ui/ui.gyp:ui', '<(DEPTH)/ui/ui.gyp:ui_resources', 'compositor', - 'compositor_test_support', ], 'sources': [ 'layer_unittest.cc', diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h index 574fed8..1251b6a 100644 --- a/ui/gfx/compositor/compositor.h +++ b/ui/gfx/compositor/compositor.h @@ -107,7 +107,9 @@ class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { virtual void Blur(const gfx::Rect& bounds) = 0; // Schedules a redraw of the layer tree associated with this compositor. - virtual void ScheduleDraw(); + void ScheduleDraw() { + delegate_->ScheduleDraw(); + } // Sets the root of the layer tree drawn by this Compositor. // The Compositor does not own the root layer. @@ -148,8 +150,6 @@ class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> { virtual void OnNotifyEnd() = 0; virtual void OnWidgetSizeChanged() = 0; - virtual void OnRootLayerChanged(); - virtual void DrawTree(); CompositorDelegate* delegate() { return delegate_; } diff --git a/ui/gfx/compositor/compositor_cc.cc b/ui/gfx/compositor/compositor_cc.cc deleted file mode 100644 index 1aaddab..0000000 --- a/ui/gfx/compositor/compositor_cc.cc +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2011 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 "ui/gfx/compositor/compositor_cc.h" - -#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" -#include "ui/gfx/compositor/layer.h" -#include "webkit/glue/webthread_impl.h" -#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" - -namespace { -webkit_glue::WebThreadImpl* g_compositor_thread = NULL; -} // anonymous namespace - -namespace ui { - -TextureCC::TextureCC() { -} - -void TextureCC::SetCanvas(const SkCanvas& canvas, - const gfx::Point& origin, - const gfx::Size& overall_size) { -} - -void TextureCC::Draw(const ui::TextureDrawParams& params, - const gfx::Rect& clip_bounds_in_texture) { -} - -CompositorCC::CompositorCC(CompositorDelegate* delegate, - gfx::AcceleratedWidget widget, - const gfx::Size& size) - : Compositor(delegate, size), - widget_(widget), - root_web_layer_(WebKit::WebLayer::create(this)) { - WebKit::WebLayerTreeView::Settings settings; - settings.enableCompositorThread = !!g_compositor_thread; - host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings); - root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); - OnWidgetSizeChanged(); -} - -CompositorCC::~CompositorCC() { -} - -void CompositorCC::InitializeThread() { - g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); - WebKit::WebCompositor::setThread(g_compositor_thread); -} - -void CompositorCC::TerminateThread() { - DCHECK(g_compositor_thread); - delete g_compositor_thread; - g_compositor_thread = NULL; -} - -Texture* CompositorCC::CreateTexture() { - return new TextureCC(); -} - -void CompositorCC::Blur(const gfx::Rect& bounds) { - NOTIMPLEMENTED(); -} - -void CompositorCC::ScheduleDraw() { - if (g_compositor_thread) - host_.composite(); - else - Compositor::ScheduleDraw(); -} - -void CompositorCC::OnNotifyStart(bool clear) { -} - -void CompositorCC::OnNotifyEnd() { -} - -void CompositorCC::OnWidgetSizeChanged() { - host_.setViewportSize(size()); - root_web_layer_.setBounds(size()); -} - -void CompositorCC::OnRootLayerChanged() { - root_web_layer_.removeAllChildren(); - root_web_layer_.addChild(root_layer()->web_layer()); -} - -void CompositorCC::DrawTree() { - host_.composite(); -} - -void CompositorCC::animateAndLayout(double frameBeginTime) { -} - -void CompositorCC::applyScrollDelta(const WebKit::WebSize&) { -} - -WebKit::WebGraphicsContext3D* CompositorCC::createContext3D() { - WebKit::WebGraphicsContext3D* context = - new webkit::gpu::WebGraphicsContext3DInProcessImpl(widget_, NULL); - WebKit::WebGraphicsContext3D::Attributes attrs; - context->initialize(attrs, 0, true); - return context; -} - -void CompositorCC::didRebindGraphicsContext(bool success) { -} - -void CompositorCC::scheduleComposite() { - ScheduleDraw(); -} - -void CompositorCC::notifyNeedsComposite() { - ScheduleDraw(); -} - -Compositor* Compositor::Create(CompositorDelegate* owner, - gfx::AcceleratedWidget widget, - const gfx::Size& size) { - return new CompositorCC(owner, widget, size); -} - -} // namespace ui diff --git a/ui/gfx/compositor/compositor_cc.h b/ui/gfx/compositor/compositor_cc.h deleted file mode 100644 index 72ea136..0000000 --- a/ui/gfx/compositor/compositor_cc.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2011 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 UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ -#define UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ -#pragma once - -#include "base/compiler_specific.h" -#include "ui/gfx/compositor/compositor.h" -#include "ui/gfx/size.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebLayer.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerTreeView.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerTreeViewClient.h" - -namespace gfx { -class Rect; -} - -namespace ui { - -class COMPOSITOR_EXPORT TextureCC : public Texture { - public: - TextureCC(); - - // Texture implementation. - virtual void SetCanvas(const SkCanvas& canvas, - const gfx::Point& origin, - const gfx::Size& overall_size) OVERRIDE; - - virtual void Draw(const ui::TextureDrawParams& params, - const gfx::Rect& clip_bounds_in_texture) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(TextureCC); -}; - -class COMPOSITOR_EXPORT CompositorCC : public Compositor, - public WebKit::WebLayerTreeViewClient, - public WebKit::WebLayerClient { - public: - CompositorCC(CompositorDelegate* delegate, - gfx::AcceleratedWidget widget, - const gfx::Size& size); - virtual ~CompositorCC(); - - static void InitializeThread(); - static void TerminateThread(); - - protected: - // Compositor implementation. - virtual Texture* CreateTexture() OVERRIDE; - virtual void Blur(const gfx::Rect& bounds) OVERRIDE; - virtual void ScheduleDraw() OVERRIDE; - virtual void OnNotifyStart(bool clear) OVERRIDE; - virtual void OnNotifyEnd() OVERRIDE; - virtual void OnWidgetSizeChanged() OVERRIDE; - virtual void OnRootLayerChanged() OVERRIDE; - virtual void DrawTree() OVERRIDE; - - // WebLayerTreeViewClient implementation. - virtual void animateAndLayout(double frameBeginTime) OVERRIDE; - virtual void applyScrollDelta(const WebKit::WebSize&) OVERRIDE; - virtual WebKit::WebGraphicsContext3D* createContext3D() OVERRIDE; - virtual void didRebindGraphicsContext(bool success) OVERRIDE; - virtual void scheduleComposite() OVERRIDE; - - // WebLayerClient implementation. - virtual void notifyNeedsComposite() OVERRIDE; - - private: - gfx::AcceleratedWidget widget_; - WebKit::WebLayer root_web_layer_; - WebKit::WebLayerTreeView host_; - - DISALLOW_COPY_AND_ASSIGN(CompositorCC); -}; - -} // namespace ui - -#endif // UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ diff --git a/ui/gfx/compositor/compositor_test_support.cc b/ui/gfx/compositor/compositor_test_support.cc deleted file mode 100644 index e72bd0c..0000000 --- a/ui/gfx/compositor/compositor_test_support.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2011 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 "ui/gfx/compositor/compositor_test_support.h" - -#if defined(USE_WEBKIT_COMPOSITOR) -#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" -#include "webkit/glue/webkitplatformsupport_impl.h" -#endif - -namespace ui { - -#if defined(USE_WEBKIT_COMPOSITOR) -static webkit_glue::WebKitPlatformSupportImpl* g_webkit_support; -#endif - -void CompositorTestSupport::Initialize() { -#if defined(USE_WEBKIT_COMPOSITOR) - DCHECK(!g_webkit_support); - g_webkit_support = new webkit_glue::WebKitPlatformSupportImpl; - WebKit::initialize(g_webkit_support); -#endif -} - -void CompositorTestSupport::Terminate() { -#if defined(USE_WEBKIT_COMPOSITOR) - DCHECK(g_webkit_support); - WebKit::shutdown(); - delete g_webkit_support; - g_webkit_support = NULL; -#endif -} - -} // namespace ui diff --git a/ui/gfx/compositor/compositor_test_support.h b/ui/gfx/compositor/compositor_test_support.h deleted file mode 100644 index de520a0..0000000 --- a/ui/gfx/compositor/compositor_test_support.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2011 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 UI_GFX_COMPOSITOR_TEST_SUPPORT_H_ -#define UI_GFX_COMPOSITOR_TEST_SUPPORT_H_ -#pragma once - -namespace ui { - -class CompositorTestSupport { - public: - static void Initialize(); - static void Terminate(); -}; - -} // namespace ui - -#endif // UI_GFX_COMPOSITOR_TEST_SUPPORT_H_ diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc index 1a42754..c094b1e 100644 --- a/ui/gfx/compositor/layer.cc +++ b/ui/gfx/compositor/layer.cc @@ -8,9 +8,6 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatRect.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" #include "ui/base/animation/animation.h" #include "ui/gfx/compositor/layer_animator.h" #include "ui/gfx/canvas_skia.h" @@ -39,9 +36,6 @@ Layer::Layer(Compositor* compositor) layer_updated_externally_(false), opacity_(1.0f), delegate_(NULL) { -#if defined(USE_WEBKIT_COMPOSITOR) - CreateWebLayer(); -#endif } Layer::Layer(Compositor* compositor, LayerType type) @@ -53,9 +47,6 @@ Layer::Layer(Compositor* compositor, LayerType type) layer_updated_externally_(false), opacity_(1.0f), delegate_(NULL) { -#if defined(USE_WEBKIT_COMPOSITOR) - CreateWebLayer(); -#endif } Layer::~Layer() { @@ -63,9 +54,6 @@ Layer::~Layer() { parent_->Remove(this); for (size_t i = 0; i < children_.size(); ++i) children_[i]->parent_ = NULL; -#if defined(USE_WEBKIT_COMPOSITOR) - web_layer_.removeFromParent(); -#endif } Compositor* Layer::GetCompositor() { @@ -86,9 +74,6 @@ void Layer::Add(Layer* child) { child->parent_->Remove(child); child->parent_ = this; children_.push_back(child); -#if defined(USE_WEBKIT_COMPOSITOR) - web_layer_.addChild(child->web_layer_); -#endif RecomputeHole(); } @@ -99,9 +84,6 @@ void Layer::Remove(Layer* child) { DCHECK(i != children_.end()); children_.erase(i); child->parent_ = NULL; -#if defined(USE_WEBKIT_COMPOSITOR) - child->web_layer_.removeFromParent(); -#endif RecomputeHole(); @@ -114,10 +96,6 @@ void Layer::MoveToFront(Layer* child) { DCHECK(i != children_.end()); children_.erase(i); children_.push_back(child); -#if defined(USE_WEBKIT_COMPOSITOR) - child->web_layer_.removeFromParent(); - web_layer_.addChild(child->web_layer_); -#endif } bool Layer::Contains(const Layer* other) const { @@ -187,10 +165,6 @@ void Layer::SetVisible(bool visible) { DropTextures(); if (parent_) parent_->RecomputeHole(); -#if defined(USE_WEBKIT_COMPOSITOR) - // TODO(piman): Expose a visibility flag on WebLayer. - web_layer_.setOpacity(visible_ ? opacity_ : 0.f); -#endif } bool Layer::IsDrawn() const { @@ -200,7 +174,7 @@ bool Layer::IsDrawn() const { return layer == NULL; } -bool Layer::ShouldDraw() const { +bool Layer::ShouldDraw() { return type_ == LAYER_HAS_TEXTURE && GetCombinedOpacity() > 0.0f && !hole_rect_.Contains(gfx::Rect(gfx::Point(0, 0), bounds_.size())); } @@ -232,9 +206,6 @@ void Layer::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { if (parent()) parent()->RecomputeHole(); -#if defined(USE_WEBKIT_COMPOSITOR) - web_layer_.setOpaque(fills_bounds_opaquely); -#endif } void Layer::SetExternalTexture(ui::Texture* texture) { @@ -244,9 +215,6 @@ void Layer::SetExternalTexture(ui::Texture* texture) { } void Layer::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) { -#if defined(USE_WEBKIT_COMPOSITOR) - NOTREACHED(); -#else DCHECK_EQ(type_, LAYER_HAS_TEXTURE); if (!texture_.get()) @@ -254,32 +222,19 @@ void Layer::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) { texture_->SetCanvas(canvas, origin, bounds_.size()); invalid_rect_ = gfx::Rect(); -#endif } void Layer::SchedulePaint(const gfx::Rect& invalid_rect) { -#if defined(USE_WEBKIT_COMPOSITOR) - WebKit::WebFloatRect web_rect(invalid_rect.x(), - invalid_rect.y(), - invalid_rect.width(), - invalid_rect.height()); - web_layer_.invalidateRect(web_rect); -#else invalid_rect_ = invalid_rect_.Union(invalid_rect); ScheduleDraw(); -#endif } void Layer::ScheduleDraw() { - Compositor* compositor = GetCompositor(); - if (compositor) - compositor->ScheduleDraw(); + if (GetCompositor()) + GetCompositor()->ScheduleDraw(); } void Layer::Draw() { -#if defined(USE_WEBKIT_COMPOSITOR) - NOTREACHED(); -#else DCHECK(GetCompositor()); if (!ShouldDraw()) return; @@ -319,38 +274,15 @@ void Layer::Draw() { if (!regions_to_draw[i].IsEmpty()) texture_->Draw(texture_draw_params, regions_to_draw[i]); } -#endif } void Layer::DrawTree() { -#if defined(USE_WEBKIT_COMPOSITOR) - NOTREACHED(); -#else if (!visible_) return; Draw(); for (size_t i = 0; i < children_.size(); ++i) children_.at(i)->DrawTree(); -#endif -} - -void Layer::notifyNeedsComposite() { -#if defined(USE_WEBKIT_COMPOSITOR) - ScheduleDraw(); -#else - NOTREACHED(); -#endif -} - -void Layer::paintContents(WebKit::WebCanvas* web_canvas, - const WebKit::WebRect& clip) { -#if defined(USE_WEBKIT_COMPOSITOR) - gfx::CanvasSkia canvas(web_canvas); - delegate_->OnPaintLayer(&canvas); -#else - NOTREACHED(); -#endif } float Layer::GetCombinedOpacity() const { @@ -364,9 +296,6 @@ float Layer::GetCombinedOpacity() const { } void Layer::UpdateLayerCanvas() { -#if defined(USE_WEBKIT_COMPOSITOR) - NOTREACHED(); -#else // If we have no delegate, that means that whoever constructed the Layer is // setting its canvas directly with SetCanvas(). if (!delegate_ || layer_updated_externally_) @@ -383,7 +312,6 @@ void Layer::UpdateLayerCanvas() { canvas->TranslateInt(-draw_rect.x(), -draw_rect.y()); delegate_->OnPaintLayer(canvas.get()); SetCanvas(*canvas->GetSkCanvas(), draw_rect.origin()); -#endif } void Layer::RecomputeHole() { @@ -429,10 +357,6 @@ void Layer::RecomputeHole() { // Free up texture memory if the hole fills bounds of layer. if (!ShouldDraw() && !layer_updated_externally_) texture_ = NULL; - -#if defined(USE_WEBKIT_COMPOSITOR) - RecomputeDrawsContent(); -#endif } bool Layer::IsCompletelyOpaque() const { @@ -542,11 +466,6 @@ void Layer::SetBoundsImmediately(const gfx::Rect& bounds) { if (parent()) parent()->RecomputeHole(); -#if defined(USE_WEBKIT_COMPOSITOR) - web_layer_.setBounds(bounds.size()); - RecomputeTransform(); - RecomputeDrawsContent(); -#endif } void Layer::SetTransformImmediately(const ui::Transform& transform) { @@ -554,9 +473,6 @@ void Layer::SetTransformImmediately(const ui::Transform& transform) { if (parent()) parent()->RecomputeHole(); -#if defined(USE_WEBKIT_COMPOSITOR) - RecomputeTransform(); -#endif } void Layer::SetOpacityImmediately(float opacity) { @@ -579,11 +495,6 @@ void Layer::SetOpacityImmediately(float opacity) { to_process.push(current->children_.at(i)); } } -#if defined(USE_WEBKIT_COMPOSITOR) - if (visible_) - web_layer_.setOpacity(opacity); - RecomputeDrawsContent(); -#endif } void Layer::SetBoundsFromAnimator(const gfx::Rect& bounds) { @@ -598,23 +509,4 @@ void Layer::SetOpacityFromAnimator(float opacity) { SetOpacityImmediately(opacity); } -#if defined(USE_WEBKIT_COMPOSITOR) -void Layer::CreateWebLayer() { - web_layer_ = WebKit::WebContentLayer::create(this, this); - web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); - web_layer_.setOpaque(true); - RecomputeDrawsContent(); -} - -void Layer::RecomputeTransform() { - ui::Transform transform = transform_; - transform.ConcatTranslate(bounds_.x(), bounds_.y()); - web_layer_.setTransform(transform.matrix()); -} - -void Layer::RecomputeDrawsContent() { - web_layer_.setDrawsContent(ShouldDraw()); -} -#endif - } // namespace ui diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h index 9e3a2d0..86ae4fd 100644 --- a/ui/gfx/compositor/layer.h +++ b/ui/gfx/compositor/layer.h @@ -12,9 +12,6 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayer.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayerClient.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h" #include "ui/gfx/rect.h" #include "ui/gfx/transform.h" #include "ui/gfx/compositor/compositor.h" @@ -38,9 +35,7 @@ class Texture; // NOTE: unlike Views, each Layer does *not* own its children views. If you // delete a Layer and it has children, the parent of each child layer is set to // NULL, but the children are not deleted. -class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate, - public WebKit::WebLayerClient, - public WebKit::WebContentLayerClient { +class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate { public: enum LayerType { LAYER_HAS_NO_TEXTURE = 0, @@ -122,7 +117,7 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate, // Returns true if this layer can have a texture (has_texture_ is true) // and is not completely obscured by a child. - bool ShouldDraw() const; + bool ShouldDraw(); // Converts a point from the coordinates of |source| to the coordinates of // |target|. Necessarily, |source| and |target| must inhabit the same Layer @@ -170,16 +165,6 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate, // (e.g. the GPU process on TOUCH_UI). bool layer_updated_externally() const { return layer_updated_externally_; } - // WebLayerClient - virtual void notifyNeedsComposite(); - - // WebContentLayerClient - virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); - -#if defined(USE_WEBKIT_COMPOSITOR) - WebKit::WebContentLayer web_layer() { return web_layer_; } -#endif - private: // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than // 1.0, we'll render to a separate texture, and then apply the alpha. @@ -254,12 +239,6 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate, virtual void SetTransformFromAnimator(const Transform& transform) OVERRIDE; virtual void SetOpacityFromAnimator(float opacity) OVERRIDE; -#if defined(USE_WEBKIT_COMPOSITOR) - void CreateWebLayer(); - void RecomputeTransform(); - void RecomputeDrawsContent(); -#endif - const LayerType type_; Compositor* compositor_; @@ -292,10 +271,6 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate, scoped_ptr<LayerAnimator> animator_; -#if defined(USE_WEBKIT_COMPOSITOR) - WebKit::WebContentLayer web_layer_; -#endif - DISALLOW_COPY_AND_ASSIGN(Layer); }; diff --git a/ui/gfx/compositor/layer_unittest.cc b/ui/gfx/compositor/layer_unittest.cc index 46e9851..6c5efb7 100644 --- a/ui/gfx/compositor/layer_unittest.cc +++ b/ui/gfx/compositor/layer_unittest.cc @@ -25,26 +25,6 @@ namespace { // - LayerWithRealCompositorTest when a real compositor is required for testing. // - Slow because they bring up a window and run the real compositor. This // is typically not what you want. - -class ColoredLayer : public Layer, public LayerDelegate { - public: - ColoredLayer(Compositor* compositor, SkColor color) - : Layer(compositor, Layer::LAYER_HAS_TEXTURE), - color_(color) { - set_delegate(this); - } - - virtual ~ColoredLayer() { } - - // Overridden from LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { - canvas->GetSkCanvas()->drawColor(color_); - } - - private: - SkColor color_; -}; - class LayerWithRealCompositorTest : public testing::Test { public: LayerWithRealCompositorTest() {} @@ -69,8 +49,9 @@ class LayerWithRealCompositorTest : public testing::Test { } Layer* CreateColorLayer(SkColor color, const gfx::Rect& bounds) { - Layer* layer = new ColoredLayer(GetCompositor(), color); + Layer* layer = CreateLayer(Layer::LAYER_HAS_TEXTURE); layer->SetBounds(bounds); + PaintColorToLayer(layer, color); return layer; } @@ -86,6 +67,13 @@ class LayerWithRealCompositorTest : public testing::Test { false); } + void PaintColorToLayer(Layer* layer, SkColor color) { + scoped_ptr<gfx::Canvas> canvas(CreateCanvasForLayer(layer)); + canvas->FillRectInt(color, 0, 0, layer->bounds().width(), + layer->bounds().height()); + layer->SetCanvas(*canvas->GetSkCanvas(), layer->bounds().origin()); + } + void DrawTree(Layer* root) { GetCompositor()->SetRootLayer(root); GetCompositor()->Draw(false); @@ -102,6 +90,7 @@ class LayerWithRealCompositorTest : public testing::Test { } private: + MessageLoopForUI message_loop_; scoped_ptr<TestCompositorHost> window_; DISALLOW_COPY_AND_ASSIGN(LayerWithRealCompositorTest); @@ -110,7 +99,7 @@ class LayerWithRealCompositorTest : public testing::Test { // LayerDelegate that paints colors to the layer. class TestLayerDelegate : public LayerDelegate { public: - explicit TestLayerDelegate() : color_index_(0) {} + explicit TestLayerDelegate(Layer* owner) : owner_(owner), color_index_(0) {} virtual ~TestLayerDelegate() {} void AddColor(SkColor color) { @@ -131,6 +120,7 @@ class TestLayerDelegate : public LayerDelegate { } private: + Layer* owner_; std::vector<SkColor> colors_; int color_index_; gfx::Size paint_size_; @@ -180,17 +170,11 @@ class NullLayerDelegate : public LayerDelegate { #if defined(OS_WIN) // These are disabled on windows as they don't run correctly on the buildbot. // Reenable once we move to the real compositor. -#define MAYBE_Delegate DISABLED_Delegate #define MAYBE_Draw DISABLED_Draw -#define MAYBE_DrawTree DISABLED_DrawTree #define MAYBE_Hierarchy DISABLED_Hierarchy -#define MAYBE_HierarchyNoTexture DISABLED_HierarchyNoTexture #else -#define MAYBE_Delegate Delegate #define MAYBE_Draw Draw -#define MAYBE_DrawTree DrawTree #define MAYBE_Hierarchy Hierarchy -#define MAYBE_HierarchyNoTexture HierarchyNoTexture #endif TEST_F(LayerWithRealCompositorTest, MAYBE_Draw) { @@ -242,8 +226,9 @@ class LayerWithDelegateTest : public testing::Test { } Layer* CreateColorLayer(SkColor color, const gfx::Rect& bounds) { - Layer* layer = new ColoredLayer(compositor(), color); + Layer* layer = CreateLayer(Layer::LAYER_HAS_TEXTURE); layer->SetBounds(bounds); + PaintColorToLayer(layer, color); return layer; } @@ -259,6 +244,13 @@ class LayerWithDelegateTest : public testing::Test { false); } + void PaintColorToLayer(Layer* layer, SkColor color) { + scoped_ptr<gfx::Canvas> canvas(CreateCanvasForLayer(layer)); + canvas->FillRectInt(color, 0, 0, layer->bounds().width(), + layer->bounds().height()); + layer->SetCanvas(*canvas->GetSkCanvas(), layer->bounds().origin()); + } + void DrawTree(Layer* root) { compositor()->SetRootLayer(root); compositor()->Draw(false); @@ -272,7 +264,7 @@ class LayerWithDelegateTest : public testing::Test { // Invokes DrawTree on the compositor. void Draw() { - compositor_->Draw(false); + compositor_->root_layer()->DrawTree(); } private: @@ -327,35 +319,34 @@ TEST_F(LayerWithDelegateTest, ConvertPointToLayer_Medium) { EXPECT_EQ(point2_in_l3_coords, point2_in_l1_coords); } -TEST_F(LayerWithRealCompositorTest, MAYBE_Delegate) { +TEST_F(LayerWithDelegateTest, Delegate) { scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorBLACK, gfx::Rect(20, 20, 400, 400))); - GetCompositor()->SetRootLayer(l1.get()); - RunPendingMessages(); - - TestLayerDelegate delegate; + TestLayerDelegate delegate(l1.get()); l1->set_delegate(&delegate); delegate.AddColor(SK_ColorWHITE); delegate.AddColor(SK_ColorYELLOW); delegate.AddColor(SK_ColorGREEN); + compositor()->SetRootLayer(l1.get()); + l1->SchedulePaint(gfx::Rect(0, 0, 400, 400)); - RunPendingMessages(); + Draw(); EXPECT_EQ(delegate.color_index(), 1); EXPECT_EQ(delegate.paint_size(), l1->bounds().size()); l1->SchedulePaint(gfx::Rect(10, 10, 200, 200)); - RunPendingMessages(); + Draw(); EXPECT_EQ(delegate.color_index(), 2); EXPECT_EQ(delegate.paint_size(), gfx::Size(200, 200)); l1->SchedulePaint(gfx::Rect(5, 5, 50, 50)); - RunPendingMessages(); + Draw(); EXPECT_EQ(delegate.color_index(), 0); EXPECT_EQ(delegate.paint_size(), gfx::Size(50, 50)); } -TEST_F(LayerWithRealCompositorTest, MAYBE_DrawTree) { +TEST_F(LayerWithDelegateTest, DrawTree) { scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED, gfx::Rect(20, 20, 400, 400))); scoped_ptr<Layer> l2(CreateColorLayer(SK_ColorBLUE, @@ -365,9 +356,6 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_DrawTree) { l1->Add(l2.get()); l2->Add(l3.get()); - GetCompositor()->SetRootLayer(l1.get()); - RunPendingMessages(); - DrawTreeLayerDelegate d1; l1->set_delegate(&d1); DrawTreeLayerDelegate d2; @@ -375,8 +363,10 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_DrawTree) { DrawTreeLayerDelegate d3; l3->set_delegate(&d3); + compositor()->SetRootLayer(l1.get()); + l2->SchedulePaint(gfx::Rect(5, 5, 5, 5)); - RunPendingMessages(); + Draw(); EXPECT_FALSE(d1.painted()); EXPECT_TRUE(d2.painted()); EXPECT_FALSE(d3.painted()); @@ -389,7 +379,7 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_DrawTree) { // | +-- L3 - yellow // +-- L4 - magenta // -TEST_F(LayerWithRealCompositorTest, MAYBE_HierarchyNoTexture) { +TEST_F(LayerWithDelegateTest, HierarchyNoTexture) { scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED, gfx::Rect(20, 20, 400, 400))); scoped_ptr<Layer> l2(CreateNoTextureLayer(gfx::Rect(10, 10, 350, 350))); @@ -402,17 +392,16 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_HierarchyNoTexture) { l1->Add(l4.get()); l2->Add(l3.get()); - GetCompositor()->SetRootLayer(l1.get()); - RunPendingMessages(); - DrawTreeLayerDelegate d2; l2->set_delegate(&d2); DrawTreeLayerDelegate d3; l3->set_delegate(&d3); + compositor()->SetRootLayer(l1.get()); + l2->SchedulePaint(gfx::Rect(5, 5, 5, 5)); l3->SchedulePaint(gfx::Rect(5, 5, 5, 5)); - RunPendingMessages(); + Draw(); // |d2| should not have received a paint notification since it has no texture. EXPECT_FALSE(d2.painted()); @@ -477,18 +466,9 @@ TEST_F(LayerWithNullDelegateTest, LayerNoTextureSetFillsBoundsOpaquely) { EXPECT_TRUE(parent->texture() == NULL); } -// With the webkit compositor, we don't explicitly textures for layers, making -// tests that check that we do fail. -#if defined(USE_WEBKIT_COMPOSITOR) -#define WEBKIT_COMPOSITOR_FAILS(X) FAILS_ ## X -#else -#define WEBKIT_COMPOSITOR_FAILS(X) X -#endif - // Verifies that a layer does not have a texture when the hole is the size // of the parent layer. -TEST_F(LayerWithNullDelegateTest, - WEBKIT_COMPOSITOR_FAILS(LayerNoTextureHoleSizeOfLayer)) { +TEST_F(LayerWithNullDelegateTest, LayerNoTextureHoleSizeOfLayer) { scoped_ptr<Layer> parent(CreateTextureRootLayer(gfx::Rect(0, 0, 400, 400))); scoped_ptr<Layer> child(CreateTextureLayer(gfx::Rect(50, 50, 100, 100))); parent->Add(child.get()); @@ -503,8 +483,7 @@ TEST_F(LayerWithNullDelegateTest, } // Verifies that a layer which has opacity == 0 does not have a texture. -TEST_F(LayerWithNullDelegateTest, - WEBKIT_COMPOSITOR_FAILS(LayerNoTextureTransparent)) { +TEST_F(LayerWithNullDelegateTest, LayerNoTextureTransparent) { scoped_ptr<Layer> parent(CreateTextureRootLayer(gfx::Rect(0, 0, 400, 400))); scoped_ptr<Layer> child(CreateTextureLayer(gfx::Rect(50, 50, 100, 100))); parent->Add(child.get()); @@ -527,8 +506,7 @@ TEST_F(LayerWithNullDelegateTest, } // Verifies that no texture is created for a layer with empty bounds. -TEST_F(LayerWithNullDelegateTest, - WEBKIT_COMPOSITOR_FAILS(LayerTextureNonEmptySchedulePaint)) { +TEST_F(LayerWithNullDelegateTest, LayerTextureNonEmptySchedulePaint) { scoped_ptr<Layer> layer(CreateTextureRootLayer(gfx::Rect(0, 0, 0, 0))); Draw(); EXPECT_TRUE(layer->texture() == NULL); @@ -611,7 +589,7 @@ TEST_F(LayerWithNullDelegateTest, HoleWithNinetyDegreeTransforms) { // +- L12 (no texture) (added after L1 is already set as root-layer) // +- L121 (texture) // +- L122 (texture) -TEST_F(LayerWithNullDelegateTest, WEBKIT_COMPOSITOR_FAILS(NoCompositor)) { +TEST_F(LayerWithNullDelegateTest, NoCompositor) { scoped_ptr<Layer> l1(CreateLayer(Layer::LAYER_HAS_NO_TEXTURE)); scoped_ptr<Layer> l11(CreateLayer(Layer::LAYER_HAS_TEXTURE)); scoped_ptr<Layer> l12(CreateLayer(Layer::LAYER_HAS_NO_TEXTURE)); diff --git a/ui/gfx/compositor/test_compositor.cc b/ui/gfx/compositor/test_compositor.cc index f34021e..311a923 100644 --- a/ui/gfx/compositor/test_compositor.cc +++ b/ui/gfx/compositor/test_compositor.cc @@ -40,12 +40,6 @@ void TestCompositor::OnNotifyEnd() { void TestCompositor::Blur(const gfx::Rect& bounds) { } -void TestCompositor::DrawTree() { -#if !defined(USE_WEBKIT_COMPOSITOR) - Compositor::DrawTree(); -#endif -} - void TestCompositor::OnWidgetSizeChanged() { } diff --git a/ui/gfx/compositor/test_compositor.h b/ui/gfx/compositor/test_compositor.h index 6af5a94..b7d2cfa 100644 --- a/ui/gfx/compositor/test_compositor.h +++ b/ui/gfx/compositor/test_compositor.h @@ -26,7 +26,6 @@ class TestCompositor : public ui::Compositor { virtual void OnNotifyStart(bool clear) OVERRIDE; virtual void OnNotifyEnd() OVERRIDE; virtual void Blur(const gfx::Rect& bounds) OVERRIDE; - virtual void DrawTree() OVERRIDE; protected: virtual void OnWidgetSizeChanged() OVERRIDE; diff --git a/ui/gfx/compositor/test_compositor_host_linux.cc b/ui/gfx/compositor/test_compositor_host_linux.cc index f3dba94..c6ea0c5 100644 --- a/ui/gfx/compositor/test_compositor_host_linux.cc +++ b/ui/gfx/compositor/test_compositor_host_linux.cc @@ -90,8 +90,7 @@ ui::Compositor* TestCompositorHostLinux::GetCompositor() { } void TestCompositorHostLinux::ScheduleDraw() { - if (compositor_) - compositor_->Draw(false); + compositor_->Draw(false); } #if defined(TOUCH_UI) || defined(USE_AURA) diff --git a/ui/gfx/compositor/test_suite.cc b/ui/gfx/compositor/test_suite.cc index 66d4b26..f26cd31 100644 --- a/ui/gfx/compositor/test_suite.cc +++ b/ui/gfx/compositor/test_suite.cc @@ -4,23 +4,14 @@ #include "ui/gfx/compositor/test_suite.h" -#include "base/message_loop.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" -#include "ui/gfx/compositor/compositor_test_support.h" #include "ui/gfx/gfx_paths.h" #include "ui/gfx/gl/gl_implementation.h" -#if defined(USE_WEBKIT_COMPOSITOR) -#include "ui/gfx/compositor/compositor_cc.h" -#endif - CompositorTestSuite::CompositorTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} -CompositorTestSuite::~CompositorTestSuite() {} - void CompositorTestSuite::Initialize() { #if defined(OS_LINUX) gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); @@ -33,15 +24,9 @@ void CompositorTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstance("en-US"); - - message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); - ui::CompositorTestSupport::Initialize(); } void CompositorTestSuite::Shutdown() { - ui::CompositorTestSupport::Terminate(); - message_loop_.reset(); - ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); diff --git a/ui/gfx/compositor/test_suite.h b/ui/gfx/compositor/test_suite.h index 5566282..0472a24 100644 --- a/ui/gfx/compositor/test_suite.h +++ b/ui/gfx/compositor/test_suite.h @@ -7,27 +7,16 @@ #pragma once #include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" #include "base/test/test_suite.h" -namespace ui { -class WebKitPlatformSupportImpl; -} // namespace ui - -class MessageLoop; - class CompositorTestSuite : public base::TestSuite { public: CompositorTestSuite(int argc, char** argv); - ~CompositorTestSuite(); protected: // base::TestSuite: virtual void Initialize() OVERRIDE; virtual void Shutdown() OVERRIDE; - - private: - scoped_ptr<MessageLoop> message_loop_; }; #endif // UI_GFX_COMPOSITOR_TEST_SUITE_H_ |