OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 completion.Wait(); | 208 completion.Wait(); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 void ThreadProxy::RequestNewOutputSurface() { | 212 void ThreadProxy::RequestNewOutputSurface() { |
213 DCHECK(IsMainThread()); | 213 DCHECK(IsMainThread()); |
214 layer_tree_host()->RequestNewOutputSurface(); | 214 layer_tree_host()->RequestNewOutputSurface(); |
215 } | 215 } |
216 | 216 |
217 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { | 217 void ThreadProxy::SetOutputSurface(scoped_ptr<OutputSurface> output_surface) { |
218 if (output_surface) { | 218 Proxy::ImplThreadTaskRunner()->PostTask( |
219 Proxy::ImplThreadTaskRunner()->PostTask( | 219 FROM_HERE, |
220 FROM_HERE, | 220 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, |
221 base::Bind(&ThreadProxy::InitializeOutputSurfaceOnImplThread, | 221 impl_thread_weak_ptr_, base::Passed(&output_surface))); |
222 impl_thread_weak_ptr_, | |
223 base::Passed(&output_surface))); | |
224 return; | |
225 } | |
226 | |
227 DidInitializeOutputSurface(false, RendererCapabilities()); | |
228 } | 222 } |
229 | 223 |
230 void ThreadProxy::DidInitializeOutputSurface( | 224 void ThreadProxy::DidInitializeOutputSurface( |
231 bool success, | 225 bool success, |
232 const RendererCapabilities& capabilities) { | 226 const RendererCapabilities& capabilities) { |
233 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); | 227 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeOutputSurface"); |
234 DCHECK(IsMainThread()); | 228 DCHECK(IsMainThread()); |
235 main().renderer_capabilities_main_thread_copy = capabilities; | |
236 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); | |
237 | 229 |
238 if (!success) { | 230 if (!success) { |
239 Proxy::MainThreadTaskRunner()->PostTask( | 231 layer_tree_host()->DidFailToInitializeOutputSurface(); |
240 FROM_HERE, | 232 return; |
241 base::Bind(&ThreadProxy::RequestNewOutputSurface, | |
242 main_thread_weak_ptr_)); | |
243 } | 233 } |
| 234 main().renderer_capabilities_main_thread_copy = capabilities; |
| 235 layer_tree_host()->DidInitializeOutputSurface(); |
244 } | 236 } |
245 | 237 |
246 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( | 238 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy( |
247 const RendererCapabilities& capabilities) { | 239 const RendererCapabilities& capabilities) { |
248 main().renderer_capabilities_main_thread_copy = capabilities; | 240 main().renderer_capabilities_main_thread_copy = capabilities; |
249 } | 241 } |
250 | 242 |
251 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { | 243 void ThreadProxy::SendCommitRequestToImplThreadIfNeeded() { |
252 DCHECK(IsMainThread()); | 244 DCHECK(IsMainThread()); |
253 if (main().commit_request_sent_to_impl_thread) | 245 if (main().commit_request_sent_to_impl_thread) |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 | 1334 |
1343 impl().timing_history.DidActivateSyncTree(); | 1335 impl().timing_history.DidActivateSyncTree(); |
1344 } | 1336 } |
1345 | 1337 |
1346 void ThreadProxy::DidPrepareTiles() { | 1338 void ThreadProxy::DidPrepareTiles() { |
1347 DCHECK(IsImplThread()); | 1339 DCHECK(IsImplThread()); |
1348 impl().scheduler->DidPrepareTiles(); | 1340 impl().scheduler->DidPrepareTiles(); |
1349 } | 1341 } |
1350 | 1342 |
1351 } // namespace cc | 1343 } // namespace cc |
OLD | NEW |