| Index: ui/compositor/compositor.cc
|
| diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
|
| index 9abe91e697d4ecbbf26fc58878ea1194457f2691..4f44a91f02cc6832f512cc73213305d603dc980e 100644
|
| --- a/ui/compositor/compositor.cc
|
| +++ b/ui/compositor/compositor.cc
|
| @@ -17,7 +17,7 @@
|
| #include "cc/input_handler.h"
|
| #include "cc/layer.h"
|
| #include "cc/layer_tree_host.h"
|
| -#include "cc/output_surface.h"
|
| +#include "cc/output_surface_impl.h"
|
| #include "cc/thread_impl.h"
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| #include "ui/compositor/compositor_observer.h"
|
| @@ -53,46 +53,6 @@ ui::ContextFactory* g_context_factory = NULL;
|
|
|
| const int kCompositorLockTimeoutMs = 67;
|
|
|
| -// Adapts a pure WebGraphicsContext3D into a cc::OutputSurface.
|
| -class WebGraphicsContextToOutputSurfaceAdapter
|
| - : public cc::OutputSurface {
|
| - public:
|
| - explicit WebGraphicsContextToOutputSurfaceAdapter(
|
| - WebKit::WebGraphicsContext3D* context)
|
| - : context3D_(context),
|
| - client_(NULL) {
|
| - }
|
| -
|
| - virtual bool BindToClient(
|
| - cc::OutputSurfaceClient* client) OVERRIDE {
|
| - DCHECK(client);
|
| - if (!context3D_->makeContextCurrent())
|
| - return false;
|
| - client_ = client;
|
| - return true;
|
| - }
|
| -
|
| - virtual const struct Capabilities& Capabilities() const OVERRIDE {
|
| - return capabilities_;
|
| - }
|
| -
|
| - virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE {
|
| - return context3D_.get();
|
| - }
|
| -
|
| - virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE {
|
| - return NULL;
|
| - }
|
| -
|
| - virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE {
|
| - }
|
| -
|
| - private:
|
| - scoped_ptr<WebKit::WebGraphicsContext3D> context3D_;
|
| - struct Capabilities capabilities_;
|
| - cc::OutputSurfaceClient* client_;
|
| -};
|
| -
|
| class PendingSwap {
|
| public:
|
| PendingSwap(SwapType type, ui::PostedSwapQueue* posted_swaps);
|
| @@ -155,8 +115,8 @@ bool DefaultContextFactory::Initialize() {
|
|
|
| cc::OutputSurface* DefaultContextFactory::CreateOutputSurface(
|
| Compositor* compositor) {
|
| - return new WebGraphicsContextToOutputSurfaceAdapter(
|
| - CreateContextCommon(compositor, false));
|
| + return new cc::OutputSurfaceImpl(
|
| + make_scoped_ptr(CreateContextCommon(compositor, false)));
|
| }
|
|
|
| WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateOffscreenContext() {
|
| @@ -318,7 +278,8 @@ Compositor::Compositor(CompositorDelegate* delegate,
|
| settings.initialDebugState.showDebugBorders =
|
| command_line->HasSwitch(switches::kUIShowLayerBorders);
|
| settings.partialSwapEnabled =
|
| - command_line->HasSwitch(switches::kUIEnablePartialSwap);
|
| + command_line->HasSwitch(switches::kUIEnablePartialSwap) ||
|
| + command_line->HasSwitch(switches::kUIEnableSoftwareCompositing);
|
| settings.perTilePaintingEnabled =
|
| command_line->HasSwitch(switches::kUIEnablePerTilePainting);
|
|
|
| @@ -507,11 +468,12 @@ void Compositor::applyScrollAndScale(gfx::Vector2d scrollDelta,
|
|
|
| scoped_ptr<cc::OutputSurface> Compositor::createOutputSurface() {
|
| if (test_compositor_enabled) {
|
| - ui::TestWebGraphicsContext3D* test_context =
|
| - new ui::TestWebGraphicsContext3D();
|
| - test_context->Initialize();
|
| + scoped_ptr<ui::TestWebGraphicsContext3D> context3d(
|
| + new ui::TestWebGraphicsContext3D);
|
| + context3d->Initialize();
|
| return scoped_ptr<cc::OutputSurface>(
|
| - new WebGraphicsContextToOutputSurfaceAdapter(test_context));
|
| + new cc::OutputSurfaceImpl(
|
| + context3d.PassAs<WebKit::WebGraphicsContext3D>()));
|
| } else {
|
| return scoped_ptr<cc::OutputSurface>(
|
| ContextFactory::GetInstance()->CreateOutputSurface(this));
|
|
|