OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (base::ThreadTaskRunnerHandle::IsSet()) { | 181 if (base::ThreadTaskRunnerHandle::IsSet()) { |
182 // Now that we are on the context thread, register a dump provider with this | 182 // Now that we are on the context thread, register a dump provider with this |
183 // thread's task runner. This will overwrite any previous dump provider | 183 // thread's task runner. This will overwrite any previous dump provider |
184 // registered. | 184 // registered. |
185 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 185 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
186 this, "OutputSurface", base::ThreadTaskRunnerHandle::Get()); | 186 this, "OutputSurface", base::ThreadTaskRunnerHandle::Get()); |
187 } | 187 } |
188 return true; | 188 return true; |
189 } | 189 } |
190 | 190 |
191 void OutputSurface::Reshape(const gfx::Size& size, | |
192 float scale_factor, | |
193 const gfx::ColorSpace& color_space, | |
194 bool has_alpha) { | |
195 device_color_space_ = color_space; | |
196 if (size == surface_size_ && scale_factor == device_scale_factor_ && | |
197 has_alpha == has_alpha_) | |
198 return; | |
199 | |
200 surface_size_ = size; | |
201 device_scale_factor_ = scale_factor; | |
202 has_alpha_ = has_alpha; | |
203 if (context_provider_.get()) { | |
204 context_provider_->ContextGL()->ResizeCHROMIUM(size.width(), size.height(), | |
205 scale_factor, has_alpha); | |
206 } | |
207 if (software_device_) | |
208 software_device_->Resize(size, scale_factor); | |
209 } | |
210 | |
211 void OutputSurface::PostSwapBuffersComplete() { | 191 void OutputSurface::PostSwapBuffersComplete() { |
212 base::ThreadTaskRunnerHandle::Get()->PostTask( | 192 base::ThreadTaskRunnerHandle::Get()->PostTask( |
213 FROM_HERE, base::Bind(&OutputSurface::OnSwapBuffersComplete, | 193 FROM_HERE, base::Bind(&OutputSurface::OnSwapBuffersComplete, |
214 weak_ptr_factory_.GetWeakPtr())); | 194 weak_ptr_factory_.GetWeakPtr())); |
215 } | 195 } |
216 | 196 |
217 // We don't post tasks bound to the client directly since they might run | 197 // We don't post tasks bound to the client directly since they might run |
218 // after the OutputSurface has been destroyed. | 198 // after the OutputSurface has been destroyed. |
219 void OutputSurface::OnSwapBuffersComplete() { | 199 void OutputSurface::OnSwapBuffersComplete() { |
220 client_->DidSwapBuffersComplete(); | 200 client_->DidSwapBuffersComplete(); |
(...skipping 11 matching lines...) Expand all Loading... |
232 } | 212 } |
233 return true; | 213 return true; |
234 } | 214 } |
235 | 215 |
236 void OutputSurface::DidLoseOutputSurface() { | 216 void OutputSurface::DidLoseOutputSurface() { |
237 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); | 217 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); |
238 client_->DidLoseOutputSurface(); | 218 client_->DidLoseOutputSurface(); |
239 } | 219 } |
240 | 220 |
241 } // namespace cc | 221 } // namespace cc |
OLD | NEW |