| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } // namespace | 68 } // namespace |
| 69 | 69 |
| 70 class SynchronousCompositorOutputSurface::SoftwareDevice | 70 class SynchronousCompositorOutputSurface::SoftwareDevice |
| 71 : public cc::SoftwareOutputDevice { | 71 : public cc::SoftwareOutputDevice { |
| 72 public: | 72 public: |
| 73 SoftwareDevice(SynchronousCompositorOutputSurface* surface) | 73 SoftwareDevice(SynchronousCompositorOutputSurface* surface) |
| 74 : surface_(surface), | 74 : surface_(surface), |
| 75 null_device_(SkBitmap::kARGB_8888_Config, 1, 1), | 75 null_device_(SkBitmap::kARGB_8888_Config, 1, 1), |
| 76 null_canvas_(&null_device_) { | 76 null_canvas_(&null_device_) { |
| 77 } | 77 } |
| 78 virtual void Resize(gfx::Size size) OVERRIDE { | 78 virtual void Resize(const gfx::Size& size) OVERRIDE { |
| 79 // Intentional no-op: canvas size is controlled by the embedder. | 79 // Intentional no-op: canvas size is controlled by the embedder. |
| 80 } | 80 } |
| 81 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE { | 81 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE { |
| 82 if (!surface_->current_sw_canvas_) { | 82 if (!surface_->current_sw_canvas_) { |
| 83 NOTREACHED() << "BeginPaint with no canvas set"; | 83 NOTREACHED() << "BeginPaint with no canvas set"; |
| 84 return &null_canvas_; | 84 return &null_canvas_; |
| 85 } | 85 } |
| 86 LOG_IF(WARNING, surface_->did_swap_buffer_) | 86 LOG_IF(WARNING, surface_->did_swap_buffer_) |
| 87 << "Mutliple calls to BeginPaint per frame"; | 87 << "Mutliple calls to BeginPaint per frame"; |
| 88 return surface_->current_sw_canvas_; | 88 return surface_->current_sw_canvas_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 output_surface_client_->SetMemoryPolicy(memory_policy_); | 149 output_surface_client_->SetMemoryPolicy(memory_policy_); |
| 150 | 150 |
| 151 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); | 151 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); |
| 152 if (delegate) | 152 if (delegate) |
| 153 delegate->DidBindOutputSurface(this); | 153 delegate->DidBindOutputSurface(this); |
| 154 | 154 |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 void SynchronousCompositorOutputSurface::Reshape( | 158 void SynchronousCompositorOutputSurface::Reshape( |
| 159 gfx::Size size, float scale_factor) { | 159 const gfx::Size& size, float scale_factor) { |
| 160 // Intentional no-op: surface size is controlled by the embedder. | 160 // Intentional no-op: surface size is controlled by the embedder. |
| 161 } | 161 } |
| 162 | 162 |
| 163 void SynchronousCompositorOutputSurface::SetNeedsBeginImplFrame( | 163 void SynchronousCompositorOutputSurface::SetNeedsBeginImplFrame( |
| 164 bool enable) { | 164 bool enable) { |
| 165 DCHECK(CalledOnValidThread()); | 165 DCHECK(CalledOnValidThread()); |
| 166 cc::OutputSurface::SetNeedsBeginImplFrame(enable); | 166 cc::OutputSurface::SetNeedsBeginImplFrame(enable); |
| 167 needs_begin_impl_frame_ = enable; | 167 needs_begin_impl_frame_ = enable; |
| 168 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); | 168 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); |
| 169 if (delegate) | 169 if (delegate) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 307 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
| 308 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 308 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 309 } | 309 } |
| 310 | 310 |
| 311 SynchronousCompositorOutputSurfaceDelegate* | 311 SynchronousCompositorOutputSurfaceDelegate* |
| 312 SynchronousCompositorOutputSurface::GetDelegate() { | 312 SynchronousCompositorOutputSurface::GetDelegate() { |
| 313 return SynchronousCompositorImpl::FromRoutingID(routing_id_); | 313 return SynchronousCompositorImpl::FromRoutingID(routing_id_); |
| 314 } | 314 } |
| 315 | 315 |
| 316 } // namespace content | 316 } // namespace content |
| OLD | NEW |