Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: content/renderer/android/synchronous_compositor_output_surface.h

Issue 15002007: Delegate root layer scroll offset to android_webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_RENDERER_ANDOIRD_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
11 #include "cc/output/output_surface.h" 12 #include "cc/output/output_surface.h"
12 #include "content/public/renderer/android/synchronous_compositor.h" 13 #include "content/public/renderer/android/synchronous_compositor.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 class SynchronousCompositorClient; 17 class SynchronousCompositorClient;
17 class WebGraphicsContext3DCommandBufferImpl; 18 class WebGraphicsContext3DCommandBufferImpl;
18 19
20 // TODO(mkosiba): Update comment.
21 //
22 //
19 // Specialization of the output surface that adapts it to implement the 23 // Specialization of the output surface that adapts it to implement the
20 // content::SynchronousCompositor public API. This class effects an "inversion 24 // content::SynchronousCompositor public API. This class effects an "inversion
21 // of control" - enabling drawing to be orchestrated by the embedding 25 // of control" - enabling drawing to be orchestrated by the embedding
22 // layer, instead of driven by the compositor internals - hence it holds two 26 // layer, instead of driven by the compositor internals - hence it holds two
23 // 'client' pointers (including |client_| in the OutputSurface baseclass) which 27 // 'client' pointers (including |client_| in the OutputSurface baseclass) which
24 // represent the consumers of the two roles in plays. 28 // represent the consumers of the two roles in plays.
25 // This class can be created only on the main thread, but then becomes pinned 29 // This class can be created only on the main thread, but then becomes pinned
26 // to a fixed thread when BindToClient is called. 30 // to a fixed thread when BindToClient is called.
27 class SynchronousCompositorOutputSurface 31 class SynchronousCompositorOutputSurface
28 : NON_EXPORTED_BASE(public cc::OutputSurface), 32 : NON_EXPORTED_BASE(public cc::OutputSurface) {
29 NON_EXPORTED_BASE(public SynchronousCompositor) {
30 public: 33 public:
31 explicit SynchronousCompositorOutputSurface(int32 routing_id); 34 class Delegate {
35 public:
36 virtual void SetContinuousInvalidate(bool enable) = 0;
37 virtual void DidCreateSynchronousCompositor() = 0;
38 virtual void DidDestroyCompositor() = 0;
39
40 protected:
41 Delegate() {}
42 virtual ~Delegate() {}
43
44 private:
45 DISALLOW_COPY_AND_ASSIGN(Delegate);
46 };
47
48 explicit SynchronousCompositorOutputSurface(Delegate* delegate);
32 virtual ~SynchronousCompositorOutputSurface(); 49 virtual ~SynchronousCompositorOutputSurface();
33 50
34 // OutputSurface. 51 // OutputSurface.
35 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; 52 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
36 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE; 53 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE;
37 virtual void Reshape(gfx::Size size) OVERRIDE; 54 virtual void Reshape(gfx::Size size) OVERRIDE;
38 virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE; 55 virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE;
39 virtual void EnableVSyncNotification(bool enable_vsync) OVERRIDE; 56 virtual void EnableVSyncNotification(bool enable_vsync) OVERRIDE;
40 virtual void SwapBuffers(const cc::LatencyInfo& info) OVERRIDE; 57 virtual void SwapBuffers(const cc::LatencyInfo& info) OVERRIDE;
41 58
42 // SynchronousCompositor. 59 // Partial SynchronousCompositor API implementation.
43 virtual void SetClient(SynchronousCompositorClient* compositor_client) 60 bool IsHwReady();
44 OVERRIDE; 61 bool DemandDrawSw(SkCanvas* canvas);
45 virtual bool IsHwReady() OVERRIDE; 62 bool DemandDrawHw(gfx::Size view_size,
46 virtual bool DemandDrawSw(SkCanvas* canvas) OVERRIDE; 63 const gfx::Transform& transform,
47 virtual bool DemandDrawHw( 64 gfx::Rect clip);
48 gfx::Size view_size,
49 const gfx::Transform& transform,
50 gfx::Rect clip) OVERRIDE;
51 65
52 private: 66 private:
53 class SoftwareDevice; 67 class SoftwareDevice;
54 friend class SoftwareDevice; 68 friend class SoftwareDevice;
55 69
56 void InvokeComposite(const gfx::Transform& transform, gfx::Rect damage_area); 70 void InvokeComposite(const gfx::Transform& transform, gfx::Rect damage_area);
57 void UpdateCompositorClientSettings(); 71 void UpdateCompositorClientSettings();
58 void NotifyCompositorSettingsChanged(); 72 void NotifyCompositorSettingsChanged();
59 bool CalledOnValidThread() const; 73 bool CalledOnValidThread() const;
60 74
61 SynchronousCompositorClient* compositor_client_; 75 Delegate* delegate_;
62 int routing_id_;
63 bool vsync_enabled_; 76 bool vsync_enabled_;
64 bool did_swap_buffer_; 77 bool did_swap_buffer_;
65 78
66 // Only valid (non-NULL) during a DemandDrawSw() call. 79 // Only valid (non-NULL) during a DemandDrawSw() call.
67 SkCanvas* current_sw_canvas_; 80 SkCanvas* current_sw_canvas_;
68 81
69 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); 82 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface);
70 }; 83 };
71 84
72 } // namespace content 85 } // namespace content
73 86
74 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 87 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698