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

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

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_ 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_ 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE _H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 22 matching lines...) Expand all
33 class SynchronousCompositorClient; 33 class SynchronousCompositorClient;
34 class SynchronousCompositorOutputSurface; 34 class SynchronousCompositorOutputSurface;
35 class WebGraphicsContext3DCommandBufferImpl; 35 class WebGraphicsContext3DCommandBufferImpl;
36 36
37 class SynchronousCompositorOutputSurfaceDelegate { 37 class SynchronousCompositorOutputSurfaceDelegate {
38 public: 38 public:
39 virtual void DidBindOutputSurface( 39 virtual void DidBindOutputSurface(
40 SynchronousCompositorOutputSurface* output_surface) = 0; 40 SynchronousCompositorOutputSurface* output_surface) = 0;
41 virtual void DidDestroySynchronousOutputSurface( 41 virtual void DidDestroySynchronousOutputSurface(
42 SynchronousCompositorOutputSurface* output_surface) = 0; 42 SynchronousCompositorOutputSurface* output_surface) = 0;
43 virtual void SetContinuousInvalidate(bool enable) = 0;
44 virtual void DidActivatePendingTree() = 0; 43 virtual void DidActivatePendingTree() = 0;
45 44
46 protected: 45 protected:
47 SynchronousCompositorOutputSurfaceDelegate() {} 46 SynchronousCompositorOutputSurfaceDelegate() {}
48 virtual ~SynchronousCompositorOutputSurfaceDelegate() {} 47 virtual ~SynchronousCompositorOutputSurfaceDelegate() {}
49 }; 48 };
50 49
51 // Specialization of the output surface that adapts it to implement the 50 // Specialization of the output surface that adapts it to implement the
52 // content::SynchronousCompositor public API. This class effects an "inversion 51 // content::SynchronousCompositor public API. This class effects an "inversion
53 // of control" - enabling drawing to be orchestrated by the embedding 52 // of control" - enabling drawing to be orchestrated by the embedding
54 // layer, instead of driven by the compositor internals - hence it holds two 53 // layer, instead of driven by the compositor internals - hence it holds two
55 // 'client' pointers (|client_| in the OutputSurface baseclass and 54 // 'client' pointers (|client_| in the OutputSurface baseclass and
56 // GetDelegate()) which represent the consumers of the two roles in plays. 55 // GetDelegate()) which represent the consumers of the two roles in plays.
57 // This class can be created only on the main thread, but then becomes pinned 56 // This class can be created only on the main thread, but then becomes pinned
58 // to a fixed thread when BindToClient is called. 57 // to a fixed thread when BindToClient is called.
59 class SynchronousCompositorOutputSurface 58 class SynchronousCompositorOutputSurface
60 : NON_EXPORTED_BASE(public cc::OutputSurface) { 59 : NON_EXPORTED_BASE(public cc::OutputSurface) {
61 public: 60 public:
62 explicit SynchronousCompositorOutputSurface( 61 explicit SynchronousCompositorOutputSurface(
63 int routing_id, 62 int routing_id,
64 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue); 63 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue);
65 virtual ~SynchronousCompositorOutputSurface(); 64 virtual ~SynchronousCompositorOutputSurface();
66 65
67 // OutputSurface. 66 // OutputSurface.
68 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) override; 67 virtual bool BindToClient(cc::OutputSurfaceClient* surface_client) override;
69 virtual void Reshape(const gfx::Size& size, float scale_factor) override; 68 virtual void Reshape(const gfx::Size& size, float scale_factor) override;
70 virtual void SetNeedsBeginFrame(bool enable) override;
71 virtual void SwapBuffers(cc::CompositorFrame* frame) override; 69 virtual void SwapBuffers(cc::CompositorFrame* frame) override;
72 70
73 // Partial SynchronousCompositor API implementation. 71 // Partial SynchronousCompositor API implementation.
74 bool InitializeHwDraw( 72 bool InitializeHwDraw(
75 scoped_refptr<cc::ContextProvider> onscreen_context_provider); 73 scoped_refptr<cc::ContextProvider> onscreen_context_provider);
76 void ReleaseHwDraw(); 74 void ReleaseHwDraw();
77 scoped_ptr<cc::CompositorFrame> DemandDrawHw( 75 scoped_ptr<cc::CompositorFrame> DemandDrawHw(
78 gfx::Size surface_size, 76 gfx::Size surface_size,
79 const gfx::Transform& transform, 77 const gfx::Transform& transform,
80 gfx::Rect viewport, 78 gfx::Rect viewport,
(...skipping 12 matching lines...) Expand all
93 void InvokeComposite(const gfx::Transform& transform, 91 void InvokeComposite(const gfx::Transform& transform,
94 gfx::Rect viewport, 92 gfx::Rect viewport,
95 gfx::Rect clip, 93 gfx::Rect clip,
96 gfx::Rect viewport_rect_for_tile_priority, 94 gfx::Rect viewport_rect_for_tile_priority,
97 gfx::Transform transform_for_tile_priority, 95 gfx::Transform transform_for_tile_priority,
98 bool hardware_draw); 96 bool hardware_draw);
99 bool CalledOnValidThread() const; 97 bool CalledOnValidThread() const;
100 SynchronousCompositorOutputSurfaceDelegate* GetDelegate(); 98 SynchronousCompositorOutputSurfaceDelegate* GetDelegate();
101 99
102 int routing_id_; 100 int routing_id_;
103 bool needs_begin_frame_;
104 bool invoking_composite_;
105 101
106 gfx::Transform cached_hw_transform_; 102 gfx::Transform cached_hw_transform_;
107 gfx::Rect cached_hw_viewport_; 103 gfx::Rect cached_hw_viewport_;
108 gfx::Rect cached_hw_clip_; 104 gfx::Rect cached_hw_clip_;
109 gfx::Rect cached_hw_viewport_rect_for_tile_priority_; 105 gfx::Rect cached_hw_viewport_rect_for_tile_priority_;
110 gfx::Transform cached_hw_transform_for_tile_priority_; 106 gfx::Transform cached_hw_transform_for_tile_priority_;
111 107
112 // Only valid (non-NULL) during a DemandDrawSw() call. 108 // Only valid (non-NULL) during a DemandDrawSw() call.
113 SkCanvas* current_sw_canvas_; 109 SkCanvas* current_sw_canvas_;
114 110
115 cc::ManagedMemoryPolicy memory_policy_; 111 cc::ManagedMemoryPolicy memory_policy_;
116 112
117 cc::OutputSurfaceClient* output_surface_client_; 113 cc::OutputSurfaceClient* output_surface_client_;
118 scoped_ptr<cc::CompositorFrame> frame_holder_; 114 scoped_ptr<cc::CompositorFrame> frame_holder_;
119 115
120 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; 116 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
121 117
122 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); 118 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface);
123 }; 119 };
124 120
125 } // namespace content 121 } // namespace content
126 122
127 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF ACE_H_ 123 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURF ACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698