Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), | 69 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), |
| 70 routing_id_(routing_id), | 70 routing_id_(routing_id), |
| 71 registry_(registry), | 71 registry_(registry), |
| 72 registered_(false), | 72 registered_(false), |
| 73 sync_client_(nullptr), | 73 sync_client_(nullptr), |
| 74 current_sw_canvas_(nullptr), | 74 current_sw_canvas_(nullptr), |
| 75 memory_policy_(0u), | 75 memory_policy_(0u), |
| 76 frame_swap_message_queue_(frame_swap_message_queue) { | 76 frame_swap_message_queue_(frame_swap_message_queue) { |
| 77 thread_checker_.DetachFromThread(); | 77 thread_checker_.DetachFromThread(); |
| 78 DCHECK(registry_); | 78 DCHECK(registry_); |
| 79 capabilities_.draw_and_swap_full_viewport_every_frame = true; | |
| 80 capabilities_.adjust_deadline_for_parent = false; | 79 capabilities_.adjust_deadline_for_parent = false; |
| 81 capabilities_.delegated_rendering = true; | 80 capabilities_.delegated_rendering = true; |
| 82 capabilities_.max_frames_pending = 1; | 81 capabilities_.max_frames_pending = 1; |
| 83 memory_policy_.priority_cutoff_when_visible = | 82 memory_policy_.priority_cutoff_when_visible = |
| 84 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; | 83 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; |
| 85 } | 84 } |
| 86 | 85 |
| 87 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {} | 86 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {} |
| 88 | 87 |
| 89 void SynchronousCompositorOutputSurface::SetSyncClient( | 88 void SynchronousCompositorOutputSurface::SetSyncClient( |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 gfx::Rect viewport_rect_for_tile_priority, | 187 gfx::Rect viewport_rect_for_tile_priority, |
| 189 gfx::Transform transform_for_tile_priority, | 188 gfx::Transform transform_for_tile_priority, |
| 190 bool hardware_draw) { | 189 bool hardware_draw) { |
| 191 DCHECK(!frame_holder_.get()); | 190 DCHECK(!frame_holder_.get()); |
| 192 | 191 |
| 193 gfx::Transform adjusted_transform = transform; | 192 gfx::Transform adjusted_transform = transform; |
| 194 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); | 193 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); |
| 195 SetExternalDrawConstraints(adjusted_transform, viewport, clip, | 194 SetExternalDrawConstraints(adjusted_transform, viewport, clip, |
| 196 viewport_rect_for_tile_priority, | 195 viewport_rect_for_tile_priority, |
| 197 transform_for_tile_priority, !hardware_draw); | 196 transform_for_tile_priority, !hardware_draw); |
| 198 SetNeedsRedrawRect(gfx::Rect(viewport.size())); | 197 if (!hardware_draw) { |
| 198 SetNeedsRedrawRect(gfx::Rect(viewport.size())); | |
|
brianderson
2015/10/22 20:53:35
Does this also need to be called for the first har
boliu
2015/10/22 20:57:53
Good question. I think the answer is yes.
This is
boliu
2015/10/22 21:50:08
Keeping it at the end of InvokeComposite here for
| |
| 199 } | |
| 199 | 200 |
| 200 client_->OnDraw(); | 201 client_->OnDraw(); |
| 201 | 202 |
| 202 // After software draws (which might move the viewport arbitrarily), restore | 203 // After software draws (which might move the viewport arbitrarily), restore |
| 203 // the previous hardware viewport to allow CC's tile manager to prioritize | 204 // the previous hardware viewport to allow CC's tile manager to prioritize |
| 204 // properly. | 205 // properly. |
| 205 if (hardware_draw) { | 206 if (hardware_draw) { |
| 206 cached_hw_transform_ = adjusted_transform; | 207 cached_hw_transform_ = adjusted_transform; |
| 207 cached_hw_viewport_ = viewport; | 208 cached_hw_viewport_ = viewport; |
| 208 cached_hw_clip_ = clip; | 209 cached_hw_clip_ = clip; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = | 263 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = |
| 263 frame_swap_message_queue_->AcquireSendMessageScope(); | 264 frame_swap_message_queue_->AcquireSendMessageScope(); |
| 264 frame_swap_message_queue_->DrainMessages(messages); | 265 frame_swap_message_queue_->DrainMessages(messages); |
| 265 } | 266 } |
| 266 | 267 |
| 267 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 268 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
| 268 return thread_checker_.CalledOnValidThread(); | 269 return thread_checker_.CalledOnValidThread(); |
| 269 } | 270 } |
| 270 | 271 |
| 271 } // namespace content | 272 } // namespace content |
| OLD | NEW |