OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | |
6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "cc/input/layer_scroll_offset_delegate.h" | |
12 #include "content/public/renderer/android/synchronous_compositor.h" | |
13 #include "content/renderer/android/synchronous_compositor_output_surface.h" | |
14 | |
15 namespace cc { | |
16 class InputHandlerClient; | |
17 class OutputSurface; | |
18 } | |
19 | |
20 namespace content { | |
21 | |
22 // 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
| |
23 // content::SynchronousCompositor public API. This class effects an "inversion | |
24 // of control" - enabling drawing to be orchestrated by the embedding | |
25 // layer, instead of driven by the compositor internals - hence it holds two | |
26 // 'client' pointers (including |client_| in the OutputSurface baseclass) which | |
27 // represent the consumers of the two roles in plays. | |
28 // This class can be created only on the main thread, but then becomes pinned | |
29 // to a fixed thread when BindToClient is called. | |
30 class SynchronousCompositorImpl | |
31 : public SynchronousCompositor, | |
32 public SynchronousCompositorOutputSurface::Delegate, | |
33 private cc::LayerScrollOffsetDelegate { | |
34 public: | |
35 explicit SynchronousCompositorImpl(int32 routing_id); | |
36 virtual ~SynchronousCompositorImpl(); | |
37 | |
38 scoped_ptr<cc::OutputSurface> CreateOutputSurface(); | |
39 scoped_ptr<cc::InputHandlerClient> CreateInputHandlerClientWrapper( | |
40 scoped_ptr<cc::InputHandlerClient> wraped_client); | |
41 | |
42 // SynchronousCompositor. | |
43 virtual bool IsHwReady() OVERRIDE; | |
44 virtual void SetClient(SynchronousCompositorClient* compositor_client) | |
45 OVERRIDE; | |
46 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; | |
47 virtual bool DemandDrawHw( | |
48 gfx::Size view_size, | |
49 const gfx::Transform& transform, | |
50 gfx::Rect clip) OVERRIDE; | |
51 | |
52 // SynchronousCompositorOutputSurface::Delegate | |
53 virtual void SetContinuousInvalidate(bool enable) OVERRIDE; | |
54 virtual void DidCreateSynchronousCompositor() OVERRIDE; | |
55 virtual void DidDestroyCompositor() OVERRIDE; | |
56 | |
57 private: | |
58 bool CalledOnValidThread() const; | |
59 | |
60 // LayerScrollOffsetDelegate | |
61 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE; | |
62 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE; | |
63 | |
64 int routing_id_; | |
65 SynchronousCompositorClient* compositor_client_; | |
66 SynchronousCompositorOutputSurface* output_surface_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); | |
69 }; | |
70 | |
71 } // namespace content | |
72 | |
73 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_IMPL_H_ | |
OLD | NEW |