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

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

Issue 1546383002: sync compositor: Send ipc reply in swap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + no swap fix Created 4 years, 11 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
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_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 21 matching lines...) Expand all
32 32
33 namespace content { 33 namespace content {
34 34
35 class FrameSwapMessageQueue; 35 class FrameSwapMessageQueue;
36 class SynchronousCompositorRegistry; 36 class SynchronousCompositorRegistry;
37 class WebGraphicsContext3DCommandBufferImpl; 37 class WebGraphicsContext3DCommandBufferImpl;
38 38
39 class SynchronousCompositorOutputSurfaceClient { 39 class SynchronousCompositorOutputSurfaceClient {
40 public: 40 public:
41 virtual void Invalidate() = 0; 41 virtual void Invalidate() = 0;
42 virtual void SwapBuffers(cc::CompositorFrame* frame) = 0;
42 43
43 protected: 44 protected:
44 virtual ~SynchronousCompositorOutputSurfaceClient() {} 45 virtual ~SynchronousCompositorOutputSurfaceClient() {}
45 }; 46 };
46 47
47 // Specialization of the output surface that adapts it to implement the 48 // Specialization of the output surface that adapts it to implement the
48 // content::SynchronousCompositor public API. This class effects an "inversion 49 // content::SynchronousCompositor public API. This class effects an "inversion
49 // of control" - enabling drawing to be orchestrated by the embedding 50 // of control" - enabling drawing to be orchestrated by the embedding
50 // layer, instead of driven by the compositor internals - hence it holds two 51 // layer, instead of driven by the compositor internals - hence it holds two
51 // 'client' pointers (|client_| in the OutputSurface baseclass and 52 // 'client' pointers (|client_| in the OutputSurface baseclass and
(...skipping 16 matching lines...) Expand all
68 // OutputSurface. 69 // OutputSurface.
69 bool BindToClient(cc::OutputSurfaceClient* surface_client) override; 70 bool BindToClient(cc::OutputSurfaceClient* surface_client) override;
70 void DetachFromClient() override; 71 void DetachFromClient() override;
71 void Reshape(const gfx::Size& size, 72 void Reshape(const gfx::Size& size,
72 float scale_factor, 73 float scale_factor,
73 bool has_alpha) override; 74 bool has_alpha) override;
74 void SwapBuffers(cc::CompositorFrame* frame) override; 75 void SwapBuffers(cc::CompositorFrame* frame) override;
75 void Invalidate() override; 76 void Invalidate() override;
76 77
77 // Partial SynchronousCompositor API implementation. 78 // Partial SynchronousCompositor API implementation.
78 scoped_ptr<cc::CompositorFrame> DemandDrawHw( 79 void DemandDrawHw(const gfx::Size& surface_size,
79 const gfx::Size& surface_size, 80 const gfx::Transform& transform,
80 const gfx::Transform& transform, 81 const gfx::Rect& viewport,
81 const gfx::Rect& viewport, 82 const gfx::Rect& clip,
82 const gfx::Rect& clip, 83 const gfx::Rect& viewport_rect_for_tile_priority,
83 const gfx::Rect& viewport_rect_for_tile_priority, 84 const gfx::Transform& transform_for_tile_priority);
84 const gfx::Transform& transform_for_tile_priority);
85 void ReturnResources(const cc::CompositorFrameAck& frame_ack); 85 void ReturnResources(const cc::CompositorFrameAck& frame_ack);
86 scoped_ptr<cc::CompositorFrame> DemandDrawSw(SkCanvas* canvas); 86 void DemandDrawSw(SkCanvas* canvas);
87 void SetMemoryPolicy(size_t bytes_limit); 87 void SetMemoryPolicy(size_t bytes_limit);
88 void SetTreeActivationCallback(const base::Closure& callback); 88 void SetTreeActivationCallback(const base::Closure& callback);
89 void GetMessagesToDeliver(std::vector<scoped_ptr<IPC::Message>>* messages); 89 void GetMessagesToDeliver(std::vector<scoped_ptr<IPC::Message>>* messages);
90 90
91 size_t GetMemoryPolicy() const { 91 size_t GetMemoryPolicy() const {
92 return memory_policy_.bytes_limit_when_visible; 92 return memory_policy_.bytes_limit_when_visible;
93 } 93 }
94 94
95 private: 95 private:
96 class SoftwareDevice; 96 class SoftwareDevice;
97 friend class SoftwareDevice; 97 friend class SoftwareDevice;
98 98
99 void InvokeComposite(const gfx::Transform& transform, 99 void InvokeComposite(const gfx::Transform& transform,
100 const gfx::Rect& viewport, 100 const gfx::Rect& viewport,
101 const gfx::Rect& clip, 101 const gfx::Rect& clip,
102 bool hardware_draw); 102 bool hardware_draw);
103 bool CalledOnValidThread() const; 103 bool CalledOnValidThread() const;
104 104
105 const int routing_id_; 105 const int routing_id_;
106 SynchronousCompositorRegistry* const registry_; // unowned 106 SynchronousCompositorRegistry* const registry_; // unowned
107 bool registered_; 107 bool registered_;
108 108
109 // Not owned. 109 // Not owned.
110 SynchronousCompositorOutputSurfaceClient* sync_client_; 110 SynchronousCompositorOutputSurfaceClient* sync_client_;
111 111
112 // Only valid (non-NULL) during a DemandDrawSw() call. 112 // Only valid (non-NULL) during a DemandDrawSw() call.
113 SkCanvas* current_sw_canvas_; 113 SkCanvas* current_sw_canvas_;
114 114
115 cc::ManagedMemoryPolicy memory_policy_; 115 cc::ManagedMemoryPolicy memory_policy_;
116 116 bool did_swap_;
117 scoped_ptr<cc::CompositorFrame> frame_holder_;
118
119 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; 117 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
120 118
121 base::ThreadChecker thread_checker_; 119 base::ThreadChecker thread_checker_;
122 120
123 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface); 121 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorOutputSurface);
124 }; 122 };
125 123
126 } // namespace content 124 } // namespace content
127 125
128 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_ 126 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698