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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_output_surface.h

Issue 16119003: Move SynchronousCompositor into content/browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_
6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_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 "cc/output/output_surface.h" 11 #include "cc/output/output_surface.h"
12 #include "content/public/renderer/android/synchronous_compositor.h" 12 #include "content/public/renderer/android/synchronous_compositor.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class SynchronousCompositorClient; 16 class SynchronousCompositorClient;
17 class SynchronousCompositorOutputSurfaceDelegate; 17 class SynchronousCompositorOutputSurfaceDelegate;
18 class WebGraphicsContext3DCommandBufferImpl; 18 class WebGraphicsContext3DCommandBufferImpl;
19 19
20 class SynchronousCompositorOutputSurfaceDelegate { 20 class SynchronousCompositorOutputSurfaceDelegate {
21 public: 21 public:
22 virtual void SetContinuousInvalidate(bool enable) = 0; 22 virtual void SetContinuousInvalidate(bool enable) = 0;
23 virtual void DidCreateSynchronousOutputSurface() = 0;
24 virtual void DidDestroySynchronousOutputSurface() = 0; 23 virtual void DidDestroySynchronousOutputSurface() = 0;
25 24
26 protected: 25 protected:
27 SynchronousCompositorOutputSurfaceDelegate() {} 26 SynchronousCompositorOutputSurfaceDelegate() {}
28 virtual ~SynchronousCompositorOutputSurfaceDelegate() {} 27 virtual ~SynchronousCompositorOutputSurfaceDelegate() {}
29 28
30 private: 29 private:
31 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurfaceDelegate); 30 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurfaceDelegate);
32 }; 31 };
33 32
34 // Specialization of the output surface that adapts it to implement the 33 // Specialization of the output surface that adapts it to implement the
35 // content::SynchronousCompositor public API. This class effects an "inversion 34 // content::SynchronousCompositor public API. This class effects an "inversion
36 // of control" - enabling drawing to be orchestrated by the embedding 35 // of control" - enabling drawing to be orchestrated by the embedding
37 // layer, instead of driven by the compositor internals - hence it holds two 36 // layer, instead of driven by the compositor internals - hence it holds two
38 // 'client' pointers (|client_| in the OutputSurface baseclass and |delegate_|) 37 // 'client' pointers (|client_| in the OutputSurface baseclass and |delegate_|)
39 // which represent the consumers of the two roles in plays. 38 // which represent the consumers of the two roles in plays.
40 // This class can be created only on the main thread, but then becomes pinned 39 // This class can be created only on the main thread, but then becomes pinned
41 // to a fixed thread when BindToClient is called. 40 // to a fixed thread when BindToClient is called.
42 class SynchronousCompositorOutputSurface 41 class SynchronousCompositorOutputSurface
43 : NON_EXPORTED_BASE(public cc::OutputSurface) { 42 : NON_EXPORTED_BASE(public cc::OutputSurface) {
44 public: 43 public:
45 explicit SynchronousCompositorOutputSurface( 44 explicit SynchronousCompositorOutputSurface(int routing_id);
46 SynchronousCompositorOutputSurfaceDelegate* delegate);
47 virtual ~SynchronousCompositorOutputSurface(); 45 virtual ~SynchronousCompositorOutputSurface();
48 46
47 void SetDelegate(
48 SynchronousCompositorOutputSurfaceDelegate* delegate) {
49 delegate_ = delegate;
50 }
51
49 // OutputSurface. 52 // OutputSurface.
50 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; 53 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE;
51 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE; 54 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) OVERRIDE;
52 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; 55 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE;
53 virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE; 56 virtual void SendFrameToParentCompositor(cc::CompositorFrame* frame) OVERRIDE;
54 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; 57 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
55 virtual void SwapBuffers(const cc::LatencyInfo& info) OVERRIDE; 58 virtual void SwapBuffers(const cc::LatencyInfo& info) OVERRIDE;
56 59
57 // Partial SynchronousCompositor API implementation. 60 // Partial SynchronousCompositor API implementation.
58 bool IsHwReady(); 61 bool IsHwReady();
59 bool DemandDrawSw(SkCanvas* canvas); 62 bool DemandDrawSw(SkCanvas* canvas);
60 bool DemandDrawHw(gfx::Size view_size, 63 bool DemandDrawHw(gfx::Size view_size,
61 const gfx::Transform& transform, 64 const gfx::Transform& transform,
62 gfx::Rect clip); 65 gfx::Rect clip);
63 66
64 private: 67 private:
65 class SoftwareDevice; 68 class SoftwareDevice;
66 friend class SoftwareDevice; 69 friend class SoftwareDevice;
67 70
68 void InvokeComposite(const gfx::Transform& transform, gfx::Rect damage_area); 71 void InvokeComposite(const gfx::Transform& transform, gfx::Rect damage_area);
69 void UpdateCompositorClientSettings(); 72 void UpdateCompositorClientSettings();
70 void NotifyCompositorSettingsChanged(); 73 void NotifyCompositorSettingsChanged();
71 bool CalledOnValidThread() const; 74 bool CalledOnValidThread() const;
72 75
76 int routing_id;
73 SynchronousCompositorOutputSurfaceDelegate* delegate_; 77 SynchronousCompositorOutputSurfaceDelegate* delegate_;
74 bool needs_begin_frame_; 78 bool needs_begin_frame_;
75 bool did_swap_buffer_; 79 bool did_swap_buffer_;
76 80
77 // Only valid (non-NULL) during a DemandDrawSw() call. 81 // Only valid (non-NULL) during a DemandDrawSw() call.
78 SkCanvas* current_sw_canvas_; 82 SkCanvas* current_sw_canvas_;
79 83
80 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); 84 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface);
81 }; 85 };
82 86
83 } // namespace content 87 } // namespace content
84 88
85 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 89 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF ACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698