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/browser/android/in_process/synchronous_input_event_filter.h" | 9 #include "content/browser/android/in_process/synchronous_input_event_filter.h" |
10 #include "content/public/browser/android/synchronous_compositor_client.h" | 10 #include "content/public/browser/android/synchronous_compositor_client.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 : compositor_client_(NULL), | 112 : compositor_client_(NULL), |
113 output_surface_(NULL), | 113 output_surface_(NULL), |
114 contents_(contents) { | 114 contents_(contents) { |
115 } | 115 } |
116 | 116 |
117 SynchronousCompositorImpl::~SynchronousCompositorImpl() { | 117 SynchronousCompositorImpl::~SynchronousCompositorImpl() { |
118 if (compositor_client_) | 118 if (compositor_client_) |
119 compositor_client_->DidDestroyCompositor(this); | 119 compositor_client_->DidDestroyCompositor(this); |
120 } | 120 } |
121 | 121 |
122 bool SynchronousCompositorImpl::IsHwReady() { | |
123 DCHECK(CalledOnValidThread()); | |
124 DCHECK(output_surface_); | |
125 | |
126 return output_surface_->IsHwReady(); | |
127 } | |
128 | |
129 void SynchronousCompositorImpl::SetClient( | 122 void SynchronousCompositorImpl::SetClient( |
130 SynchronousCompositorClient* compositor_client) { | 123 SynchronousCompositorClient* compositor_client) { |
131 DCHECK(CalledOnValidThread()); | 124 DCHECK(CalledOnValidThread()); |
132 compositor_client_ = compositor_client; | 125 compositor_client_ = compositor_client; |
133 } | 126 } |
134 | 127 |
135 bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) { | 128 bool SynchronousCompositorImpl::InitializeHwDraw() { |
136 DCHECK(CalledOnValidThread()); | 129 DCHECK(CalledOnValidThread()); |
137 DCHECK(output_surface_); | 130 DCHECK(output_surface_); |
138 | 131 return output_surface_->InitializeHwDraw(); |
139 return output_surface_->DemandDrawSw(canvas); | |
140 } | 132 } |
141 | 133 |
142 bool SynchronousCompositorImpl::DemandDrawHw( | 134 bool SynchronousCompositorImpl::DemandDrawHw( |
143 gfx::Size view_size, | 135 gfx::Size view_size, |
144 const gfx::Transform& transform, | 136 const gfx::Transform& transform, |
145 gfx::Rect damage_area) { | 137 gfx::Rect damage_area) { |
146 DCHECK(CalledOnValidThread()); | 138 DCHECK(CalledOnValidThread()); |
147 DCHECK(output_surface_); | 139 DCHECK(output_surface_); |
148 | 140 |
149 return output_surface_->DemandDrawHw(view_size, transform, damage_area); | 141 return output_surface_->DemandDrawHw(view_size, transform, damage_area); |
150 } | 142 } |
151 | 143 |
| 144 bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) { |
| 145 DCHECK(CalledOnValidThread()); |
| 146 DCHECK(output_surface_); |
| 147 |
| 148 return output_surface_->DemandDrawSw(canvas); |
| 149 } |
| 150 |
152 void SynchronousCompositorImpl::DidBindOutputSurface( | 151 void SynchronousCompositorImpl::DidBindOutputSurface( |
153 SynchronousCompositorOutputSurface* output_surface) { | 152 SynchronousCompositorOutputSurface* output_surface) { |
154 DCHECK(CalledOnValidThread()); | 153 DCHECK(CalledOnValidThread()); |
155 output_surface_ = output_surface; | 154 output_surface_ = output_surface; |
156 if (compositor_client_) | 155 if (compositor_client_) |
157 compositor_client_->DidInitializeCompositor(this); | 156 compositor_client_->DidInitializeCompositor(this); |
158 } | 157 } |
159 | 158 |
160 void SynchronousCompositorImpl::DidDestroySynchronousOutputSurface( | 159 void SynchronousCompositorImpl::DidDestroySynchronousOutputSurface( |
161 SynchronousCompositorOutputSurface* output_surface) { | 160 SynchronousCompositorOutputSurface* output_surface) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 g_factory.Get(); // Ensure it's initialized. | 197 g_factory.Get(); // Ensure it's initialized. |
199 SynchronousCompositorImpl::CreateForWebContents(contents); | 198 SynchronousCompositorImpl::CreateForWebContents(contents); |
200 } | 199 } |
201 if (SynchronousCompositorImpl* instance = | 200 if (SynchronousCompositorImpl* instance = |
202 SynchronousCompositorImpl::FromWebContents(contents)) { | 201 SynchronousCompositorImpl::FromWebContents(contents)) { |
203 instance->SetClient(client); | 202 instance->SetClient(client); |
204 } | 203 } |
205 } | 204 } |
206 | 205 |
207 } // namespace content | 206 } // namespace content |
OLD | NEW |