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

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

Issue 1769913003: sync compositor: Add output_surface_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittests compile Created 4 years, 9 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 #include "content/renderer/android/synchronous_compositor_output_surface.h" 5 #include "content/renderer/android/synchronous_compositor_output_surface.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SynchronousCompositorOutputSurface* surface_; 55 SynchronousCompositorOutputSurface* surface_;
56 SkCanvas null_canvas_; 56 SkCanvas null_canvas_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice); 58 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice);
59 }; 59 };
60 60
61 SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( 61 SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
62 const scoped_refptr<cc::ContextProvider>& context_provider, 62 const scoped_refptr<cc::ContextProvider>& context_provider,
63 const scoped_refptr<cc::ContextProvider>& worker_context_provider, 63 const scoped_refptr<cc::ContextProvider>& worker_context_provider,
64 int routing_id, 64 int routing_id,
65 uint32_t output_surface_id,
65 SynchronousCompositorRegistry* registry, 66 SynchronousCompositorRegistry* registry,
66 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) 67 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue)
67 : cc::OutputSurface( 68 : cc::OutputSurface(
68 context_provider, 69 context_provider,
69 worker_context_provider, 70 worker_context_provider,
70 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), 71 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
71 routing_id_(routing_id), 72 routing_id_(routing_id),
73 output_surface_id_(output_surface_id),
72 registry_(registry), 74 registry_(registry),
73 registered_(false), 75 registered_(false),
74 sync_client_(nullptr), 76 sync_client_(nullptr),
75 current_sw_canvas_(nullptr), 77 current_sw_canvas_(nullptr),
76 memory_policy_(0u), 78 memory_policy_(0u),
77 did_swap_(false), 79 did_swap_(false),
78 frame_swap_message_queue_(frame_swap_message_queue) { 80 frame_swap_message_queue_(frame_swap_message_queue) {
79 thread_checker_.DetachFromThread(); 81 thread_checker_.DetachFromThread();
80 DCHECK(registry_); 82 DCHECK(registry_);
81 capabilities_.adjust_deadline_for_parent = false; 83 capabilities_.adjust_deadline_for_parent = false;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void SynchronousCompositorOutputSurface::Reshape(const gfx::Size& size, 122 void SynchronousCompositorOutputSurface::Reshape(const gfx::Size& size,
121 float scale_factor, 123 float scale_factor,
122 bool has_alpha) { 124 bool has_alpha) {
123 // Intentional no-op: surface size is controlled by the embedder. 125 // Intentional no-op: surface size is controlled by the embedder.
124 } 126 }
125 127
126 void SynchronousCompositorOutputSurface::SwapBuffers( 128 void SynchronousCompositorOutputSurface::SwapBuffers(
127 cc::CompositorFrame* frame) { 129 cc::CompositorFrame* frame) {
128 DCHECK(CalledOnValidThread()); 130 DCHECK(CalledOnValidThread());
129 DCHECK(sync_client_); 131 DCHECK(sync_client_);
130 sync_client_->SwapBuffers(frame); 132 sync_client_->SwapBuffers(output_surface_id_, frame);
131 client_->DidSwapBuffers(); 133 client_->DidSwapBuffers();
132 did_swap_ = true; 134 did_swap_ = true;
133 } 135 }
134 136
135 void SynchronousCompositorOutputSurface::Invalidate() { 137 void SynchronousCompositorOutputSurface::Invalidate() {
136 DCHECK(CalledOnValidThread()); 138 DCHECK(CalledOnValidThread());
137 if (sync_client_) 139 if (sync_client_)
138 sync_client_->Invalidate(); 140 sync_client_->Invalidate();
139 } 141 }
140 142
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 gfx::Transform adjusted_transform = transform; 186 gfx::Transform adjusted_transform = transform;
185 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); 187 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0);
186 did_swap_ = false; 188 did_swap_ = false;
187 client_->OnDraw(adjusted_transform, viewport, clip, software_draw); 189 client_->OnDraw(adjusted_transform, viewport, clip, software_draw);
188 190
189 if (did_swap_) 191 if (did_swap_)
190 client_->DidSwapBuffersComplete(); 192 client_->DidSwapBuffersComplete();
191 } 193 }
192 194
193 void SynchronousCompositorOutputSurface::ReturnResources( 195 void SynchronousCompositorOutputSurface::ReturnResources(
196 uint32_t output_surface_id,
194 const cc::CompositorFrameAck& frame_ack) { 197 const cc::CompositorFrameAck& frame_ack) {
195 ReclaimResources(&frame_ack); 198 if (output_surface_id_ == output_surface_id)
199 ReclaimResources(&frame_ack);
196 } 200 }
197 201
198 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) { 202 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) {
199 DCHECK(CalledOnValidThread()); 203 DCHECK(CalledOnValidThread());
200 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit; 204 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit;
201 bool became_non_zero = 205 bool became_non_zero =
202 !memory_policy_.bytes_limit_when_visible && bytes_limit; 206 !memory_policy_.bytes_limit_when_visible && bytes_limit;
203 memory_policy_.bytes_limit_when_visible = bytes_limit; 207 memory_policy_.bytes_limit_when_visible = bytes_limit;
204 memory_policy_.num_resources_limit = kNumResourcesLimit; 208 memory_policy_.num_resources_limit = kNumResourcesLimit;
205 209
(...skipping 23 matching lines...) Expand all
229 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = 233 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope =
230 frame_swap_message_queue_->AcquireSendMessageScope(); 234 frame_swap_message_queue_->AcquireSendMessageScope();
231 frame_swap_message_queue_->DrainMessages(messages); 235 frame_swap_message_queue_->DrainMessages(messages);
232 } 236 }
233 237
234 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 238 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
235 return thread_checker_.CalledOnValidThread(); 239 return thread_checker_.CalledOnValidThread();
236 } 240 }
237 241
238 } // namespace content 242 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698