| 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/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.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/begin_frame_args.h" | 9 #include "cc/output/begin_frame_args.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 delegate->DidBindOutputSurface(this); | 114 delegate->DidBindOutputSurface(this); |
| 115 | 115 |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void SynchronousCompositorOutputSurface::Reshape( | 119 void SynchronousCompositorOutputSurface::Reshape( |
| 120 const gfx::Size& size, float scale_factor) { | 120 const gfx::Size& size, float scale_factor) { |
| 121 // Intentional no-op: surface size is controlled by the embedder. | 121 // Intentional no-op: surface size is controlled by the embedder. |
| 122 } | 122 } |
| 123 | 123 |
| 124 void SynchronousCompositorOutputSurface::SetNeedsBeginFrame(bool enable) { | 124 void SynchronousCompositorOutputSurface::SetNeedsBeginFrames( |
| 125 bool needs_begin_frames) { |
| 125 DCHECK(CalledOnValidThread()); | 126 DCHECK(CalledOnValidThread()); |
| 126 needs_begin_frame_ = enable; | 127 needs_begin_frame_ = needs_begin_frames; |
| 127 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); | 128 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); |
| 128 if (delegate && !invoking_composite_) | 129 if (delegate && !invoking_composite_) |
| 129 delegate->SetContinuousInvalidate(needs_begin_frame_); | 130 delegate->SetContinuousInvalidate(needs_begin_frame_); |
| 130 } | 131 } |
| 131 | 132 |
| 132 void SynchronousCompositorOutputSurface::SwapBuffers( | 133 void SynchronousCompositorOutputSurface::SwapBuffers( |
| 133 cc::CompositorFrame* frame) { | 134 cc::CompositorFrame* frame) { |
| 134 DCHECK(CalledOnValidThread()); | 135 DCHECK(CalledOnValidThread()); |
| 135 | 136 |
| 136 frame_holder_.reset(new cc::CompositorFrame); | 137 frame_holder_.reset(new cc::CompositorFrame); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 227 |
| 227 gfx::Transform adjusted_transform = transform; | 228 gfx::Transform adjusted_transform = transform; |
| 228 AdjustTransform(&adjusted_transform, viewport); | 229 AdjustTransform(&adjusted_transform, viewport); |
| 229 SetExternalDrawConstraints(adjusted_transform, | 230 SetExternalDrawConstraints(adjusted_transform, |
| 230 viewport, | 231 viewport, |
| 231 clip, | 232 clip, |
| 232 viewport_rect_for_tile_priority, | 233 viewport_rect_for_tile_priority, |
| 233 transform_for_tile_priority, | 234 transform_for_tile_priority, |
| 234 !hardware_draw); | 235 !hardware_draw); |
| 235 SetNeedsRedrawRect(gfx::Rect(viewport.size())); | 236 SetNeedsRedrawRect(gfx::Rect(viewport.size())); |
| 236 client_->BeginFrame(cc::BeginFrameArgs::CreateForSynchronousCompositor()); | 237 SendBeginFrame(cc::BeginFrameArgs::CreateForSynchronousCompositor()); |
| 237 | 238 |
| 238 // After software draws (which might move the viewport arbitrarily), restore | 239 // After software draws (which might move the viewport arbitrarily), restore |
| 239 // the previous hardware viewport to allow CC's tile manager to prioritize | 240 // the previous hardware viewport to allow CC's tile manager to prioritize |
| 240 // properly. | 241 // properly. |
| 241 if (hardware_draw) { | 242 if (hardware_draw) { |
| 242 cached_hw_transform_ = adjusted_transform; | 243 cached_hw_transform_ = adjusted_transform; |
| 243 cached_hw_viewport_ = viewport; | 244 cached_hw_viewport_ = viewport; |
| 244 cached_hw_clip_ = clip; | 245 cached_hw_clip_ = clip; |
| 245 cached_hw_viewport_rect_for_tile_priority_ = | 246 cached_hw_viewport_rect_for_tile_priority_ = |
| 246 viewport_rect_for_tile_priority; | 247 viewport_rect_for_tile_priority; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 293 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
| 293 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 294 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 294 } | 295 } |
| 295 | 296 |
| 296 SynchronousCompositorOutputSurfaceDelegate* | 297 SynchronousCompositorOutputSurfaceDelegate* |
| 297 SynchronousCompositorOutputSurface::GetDelegate() { | 298 SynchronousCompositorOutputSurface::GetDelegate() { |
| 298 return SynchronousCompositorImpl::FromRoutingID(routing_id_); | 299 return SynchronousCompositorImpl::FromRoutingID(routing_id_); |
| 299 } | 300 } |
| 300 | 301 |
| 301 } // namespace content | 302 } // namespace content |
| OLD | NEW |