| 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_impl.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "content/public/browser/android/synchronous_compositor_client.h" | 9 #include "content/public/browser/android/synchronous_compositor_client.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 : compositor_client_(NULL), | 75 : compositor_client_(NULL), |
| 76 output_surface_(NULL), | 76 output_surface_(NULL), |
| 77 contents_(contents) { | 77 contents_(contents) { |
| 78 } | 78 } |
| 79 | 79 |
| 80 SynchronousCompositorImpl::~SynchronousCompositorImpl() { | 80 SynchronousCompositorImpl::~SynchronousCompositorImpl() { |
| 81 if (compositor_client_) | 81 if (compositor_client_) |
| 82 compositor_client_->DidDestroyCompositor(this); | 82 compositor_client_->DidDestroyCompositor(this); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool SynchronousCompositorImpl::IsHwReady() { | |
| 86 DCHECK(CalledOnValidThread()); | |
| 87 DCHECK(output_surface_); | |
| 88 | |
| 89 return output_surface_->IsHwReady(); | |
| 90 } | |
| 91 | |
| 92 void SynchronousCompositorImpl::SetClient( | 85 void SynchronousCompositorImpl::SetClient( |
| 93 SynchronousCompositorClient* compositor_client) { | 86 SynchronousCompositorClient* compositor_client) { |
| 94 DCHECK(CalledOnValidThread()); | 87 DCHECK(CalledOnValidThread()); |
| 95 compositor_client_ = compositor_client; | 88 compositor_client_ = compositor_client; |
| 96 } | 89 } |
| 97 | 90 |
| 98 bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) { | 91 bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) { |
| 99 DCHECK(CalledOnValidThread()); | 92 DCHECK(CalledOnValidThread()); |
| 100 DCHECK(output_surface_); | 93 DCHECK(output_surface_); |
| 101 | 94 |
| 102 return output_surface_->DemandDrawSw(canvas); | 95 return output_surface_->DemandDrawSw(canvas); |
| 103 } | 96 } |
| 104 | 97 |
| 98 bool SynchronousCompositorImpl::InitializeHwDraw() { |
| 99 DCHECK(CalledOnValidThread()); |
| 100 DCHECK(output_surface_); |
| 101 return output_surface_->InitializeHwDraw(); |
| 102 } |
| 103 |
| 105 bool SynchronousCompositorImpl::DemandDrawHw( | 104 bool SynchronousCompositorImpl::DemandDrawHw( |
| 106 gfx::Size view_size, | 105 gfx::Size view_size, |
| 107 const gfx::Transform& transform, | 106 const gfx::Transform& transform, |
| 108 gfx::Rect damage_area) { | 107 gfx::Rect damage_area) { |
| 109 DCHECK(CalledOnValidThread()); | 108 DCHECK(CalledOnValidThread()); |
| 110 DCHECK(output_surface_); | 109 DCHECK(output_surface_); |
| 111 | 110 |
| 112 return output_surface_->DemandDrawHw(view_size, transform, damage_area); | 111 return output_surface_->DemandDrawHw(view_size, transform, damage_area); |
| 113 } | 112 } |
| 114 | 113 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 g_factory.Get(); // Ensure it's initialized. | 153 g_factory.Get(); // Ensure it's initialized. |
| 155 SynchronousCompositorImpl::CreateForWebContents(contents); | 154 SynchronousCompositorImpl::CreateForWebContents(contents); |
| 156 } | 155 } |
| 157 if (SynchronousCompositorImpl* instance = | 156 if (SynchronousCompositorImpl* instance = |
| 158 SynchronousCompositorImpl::FromWebContents(contents)) { | 157 SynchronousCompositorImpl::FromWebContents(contents)) { |
| 159 instance->SetClient(client); | 158 instance->SetClient(client); |
| 160 } | 159 } |
| 161 } | 160 } |
| 162 | 161 |
| 163 } // namespace content | 162 } // namespace content |
| OLD | NEW |