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

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 nit in test 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 SynchronousCompositorOutputSurface* surface_; 57 SynchronousCompositorOutputSurface* surface_;
58 SkCanvas null_canvas_; 58 SkCanvas null_canvas_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice); 60 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice);
61 }; 61 };
62 62
63 SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( 63 SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
64 const scoped_refptr<cc::ContextProvider>& context_provider, 64 const scoped_refptr<cc::ContextProvider>& context_provider,
65 const scoped_refptr<cc::ContextProvider>& worker_context_provider, 65 const scoped_refptr<cc::ContextProvider>& worker_context_provider,
66 int routing_id, 66 int routing_id,
67 uint32_t output_surface_id,
67 SynchronousCompositorRegistry* registry, 68 SynchronousCompositorRegistry* registry,
68 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) 69 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue)
69 : cc::OutputSurface( 70 : cc::OutputSurface(
70 context_provider, 71 context_provider,
71 worker_context_provider, 72 worker_context_provider,
72 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), 73 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
73 routing_id_(routing_id), 74 routing_id_(routing_id),
75 output_surface_id_(output_surface_id),
74 registry_(registry), 76 registry_(registry),
75 registered_(false), 77 registered_(false),
76 sync_client_(nullptr), 78 sync_client_(nullptr),
77 current_sw_canvas_(nullptr), 79 current_sw_canvas_(nullptr),
78 memory_policy_(0u), 80 memory_policy_(0u),
79 did_swap_(false), 81 did_swap_(false),
80 frame_swap_message_queue_(frame_swap_message_queue), 82 frame_swap_message_queue_(frame_swap_message_queue),
81 fallback_tick_pending_(false), 83 fallback_tick_pending_(false),
82 fallback_tick_running_(false) { 84 fallback_tick_running_(false) {
83 thread_checker_.DetachFromThread(); 85 thread_checker_.DetachFromThread();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 float scale_factor, 128 float scale_factor,
127 bool has_alpha) { 129 bool has_alpha) {
128 // Intentional no-op: surface size is controlled by the embedder. 130 // Intentional no-op: surface size is controlled by the embedder.
129 } 131 }
130 132
131 void SynchronousCompositorOutputSurface::SwapBuffers( 133 void SynchronousCompositorOutputSurface::SwapBuffers(
132 cc::CompositorFrame* frame) { 134 cc::CompositorFrame* frame) {
133 DCHECK(CalledOnValidThread()); 135 DCHECK(CalledOnValidThread());
134 DCHECK(sync_client_); 136 DCHECK(sync_client_);
135 if (!fallback_tick_running_) 137 if (!fallback_tick_running_)
136 sync_client_->SwapBuffers(frame); 138 sync_client_->SwapBuffers(output_surface_id_, frame);
137 client_->DidSwapBuffers(); 139 client_->DidSwapBuffers();
138 did_swap_ = true; 140 did_swap_ = true;
139 } 141 }
140 142
141 void SynchronousCompositorOutputSurface::CancelFallbackTick() { 143 void SynchronousCompositorOutputSurface::CancelFallbackTick() {
142 fallback_tick_.Cancel(); 144 fallback_tick_.Cancel();
143 fallback_tick_pending_ = false; 145 fallback_tick_pending_ = false;
144 } 146 }
145 147
146 void SynchronousCompositorOutputSurface::FallbackTickFired() { 148 void SynchronousCompositorOutputSurface::FallbackTickFired() {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 gfx::Transform adjusted_transform = transform; 222 gfx::Transform adjusted_transform = transform;
221 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); 223 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0);
222 did_swap_ = false; 224 did_swap_ = false;
223 client_->OnDraw(adjusted_transform, viewport, clip, software_draw); 225 client_->OnDraw(adjusted_transform, viewport, clip, software_draw);
224 226
225 if (did_swap_) 227 if (did_swap_)
226 client_->DidSwapBuffersComplete(); 228 client_->DidSwapBuffersComplete();
227 } 229 }
228 230
229 void SynchronousCompositorOutputSurface::ReturnResources( 231 void SynchronousCompositorOutputSurface::ReturnResources(
232 uint32_t output_surface_id,
230 const cc::CompositorFrameAck& frame_ack) { 233 const cc::CompositorFrameAck& frame_ack) {
231 ReclaimResources(&frame_ack); 234 if (output_surface_id_ == output_surface_id)
235 ReclaimResources(&frame_ack);
232 } 236 }
233 237
234 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) { 238 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) {
235 DCHECK(CalledOnValidThread()); 239 DCHECK(CalledOnValidThread());
236 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit; 240 bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit;
237 bool became_non_zero = 241 bool became_non_zero =
238 !memory_policy_.bytes_limit_when_visible && bytes_limit; 242 !memory_policy_.bytes_limit_when_visible && bytes_limit;
239 memory_policy_.bytes_limit_when_visible = bytes_limit; 243 memory_policy_.bytes_limit_when_visible = bytes_limit;
240 memory_policy_.num_resources_limit = kNumResourcesLimit; 244 memory_policy_.num_resources_limit = kNumResourcesLimit;
241 245
(...skipping 23 matching lines...) Expand all
265 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = 269 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope =
266 frame_swap_message_queue_->AcquireSendMessageScope(); 270 frame_swap_message_queue_->AcquireSendMessageScope();
267 frame_swap_message_queue_->DrainMessages(messages); 271 frame_swap_message_queue_->DrainMessages(messages);
268 } 272 }
269 273
270 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 274 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
271 return thread_checker_.CalledOnValidThread(); 275 return thread_checker_.CalledOnValidThread();
272 } 276 }
273 277
274 } // namespace content 278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698