Chromium Code Reviews| Index: content/renderer/android/synchronous_compositor_impl.h |
| diff --git a/content/renderer/android/synchronous_compositor_impl.h b/content/renderer/android/synchronous_compositor_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6453d478181792d4ad390b40101a97b37cc1139a |
| --- /dev/null |
| +++ b/content/renderer/android/synchronous_compositor_impl.h |
| @@ -0,0 +1,73 @@ |
| +// Copyright 2013 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 CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| +#define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "cc/input/layer_scroll_offset_delegate.h" |
| +#include "content/public/renderer/android/synchronous_compositor.h" |
| +#include "content/renderer/android/synchronous_compositor_output_surface.h" |
| + |
| +namespace cc { |
| +class InputHandlerClient; |
| +class OutputSurface; |
| +} |
| + |
| +namespace content { |
| + |
| +// Specialization of the output surface that adapts it to implement the |
|
joth
2013/05/16 18:21:42
comment doesn't apply here -- needs rewriting
incl
|
| +// content::SynchronousCompositor public API. This class effects an "inversion |
| +// of control" - enabling drawing to be orchestrated by the embedding |
| +// layer, instead of driven by the compositor internals - hence it holds two |
| +// 'client' pointers (including |client_| in the OutputSurface baseclass) which |
| +// represent the consumers of the two roles in plays. |
| +// This class can be created only on the main thread, but then becomes pinned |
| +// to a fixed thread when BindToClient is called. |
| +class SynchronousCompositorImpl |
| + : public SynchronousCompositor, |
| + public SynchronousCompositorOutputSurface::Delegate, |
| + private cc::LayerScrollOffsetDelegate { |
| + public: |
| + explicit SynchronousCompositorImpl(int32 routing_id); |
| + virtual ~SynchronousCompositorImpl(); |
| + |
| + scoped_ptr<cc::OutputSurface> CreateOutputSurface(); |
| + scoped_ptr<cc::InputHandlerClient> CreateInputHandlerClientWrapper( |
| + scoped_ptr<cc::InputHandlerClient> wraped_client); |
| + |
| + // SynchronousCompositor. |
| + virtual bool IsHwReady() OVERRIDE; |
| + virtual void SetClient(SynchronousCompositorClient* compositor_client) |
| + OVERRIDE; |
| + virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; |
| + virtual bool DemandDrawHw( |
| + gfx::Size view_size, |
| + const gfx::Transform& transform, |
| + gfx::Rect clip) OVERRIDE; |
| + |
| + // SynchronousCompositorOutputSurface::Delegate |
| + virtual void SetContinuousInvalidate(bool enable) OVERRIDE; |
| + virtual void DidCreateSynchronousCompositor() OVERRIDE; |
| + virtual void DidDestroyCompositor() OVERRIDE; |
| + |
| + private: |
| + bool CalledOnValidThread() const; |
| + |
| + // LayerScrollOffsetDelegate |
| + virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE; |
| + virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE; |
| + |
| + int routing_id_; |
| + SynchronousCompositorClient* compositor_client_; |
| + SynchronousCompositorOutputSurface* output_surface_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ |