| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 345 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
| 346 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 346 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
| 347 DCHECK(IsImplThread()); | 347 DCHECK(IsImplThread()); |
| 348 impl().scheduler->DidSwapBuffersComplete(); | 348 impl().scheduler->DidSwapBuffersComplete(); |
| 349 Proxy::MainThreadTaskRunner()->PostTask( | 349 Proxy::MainThreadTaskRunner()->PostTask( |
| 350 FROM_HERE, | 350 FROM_HERE, |
| 351 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 351 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void ThreadProxy::SetNeedsBeginFrame(bool enable) { | 354 BeginFrameSource* ThreadProxy::ExternalBeginFrameSource() { |
| 355 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); | 355 return impl().layer_tree_host_impl.get(); |
| 356 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); | |
| 357 UpdateBackgroundAnimateTicking(); | |
| 358 } | |
| 359 | |
| 360 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) { | |
| 361 impl().scheduler->BeginFrame(args); | |
| 362 } | 356 } |
| 363 | 357 |
| 364 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { | 358 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 365 impl().layer_tree_host_impl->WillBeginImplFrame(args); | 359 impl().layer_tree_host_impl->WillBeginImplFrame(args); |
| 366 } | 360 } |
| 367 | 361 |
| 368 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 362 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 369 TRACE_EVENT1( | 363 TRACE_EVENT1( |
| 370 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 364 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
| 371 DCHECK(IsImplThread()); | 365 DCHECK(IsImplThread()); |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 completion->Signal(); | 1239 completion->Signal(); |
| 1246 } | 1240 } |
| 1247 | 1241 |
| 1248 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1242 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
| 1249 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1243 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
| 1250 DCHECK(IsImplThread()); | 1244 DCHECK(IsImplThread()); |
| 1251 DCHECK(IsMainThreadBlocked()); | 1245 DCHECK(IsMainThreadBlocked()); |
| 1252 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1246 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
| 1253 impl().layer_tree_host_impl->resource_provider()); | 1247 impl().layer_tree_host_impl->resource_provider()); |
| 1254 impl().current_resource_update_controller.reset(); | 1248 impl().current_resource_update_controller.reset(); |
| 1255 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); | 1249 impl().layer_tree_host_impl->SetNeedsBeginFrames(false); |
| 1256 impl().scheduler.reset(); | 1250 impl().scheduler.reset(); |
| 1257 impl().layer_tree_host_impl.reset(); | 1251 impl().layer_tree_host_impl.reset(); |
| 1258 impl().weak_factory.InvalidateWeakPtrs(); | 1252 impl().weak_factory.InvalidateWeakPtrs(); |
| 1259 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. | 1253 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. |
| 1260 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep | 1254 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep |
| 1261 // the convention of having a weak ptr factory initialized last. Alternatively | 1255 // the convention of having a weak ptr factory initialized last. Alternatively |
| 1262 // we should moved the notifier (and RenewTreePriority) to LTHI. See | 1256 // we should moved the notifier (and RenewTreePriority) to LTHI. See |
| 1263 // crbug.com/411972 | 1257 // crbug.com/411972 |
| 1264 impl().smoothness_priority_expiration_notifier.Cancel(); | 1258 impl().smoothness_priority_expiration_notifier.Cancel(); |
| 1265 impl().contents_texture_manager = NULL; | 1259 impl().contents_texture_manager = NULL; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 | 1397 |
| 1404 impl().timing_history.DidActivateSyncTree(); | 1398 impl().timing_history.DidActivateSyncTree(); |
| 1405 } | 1399 } |
| 1406 | 1400 |
| 1407 void ThreadProxy::DidManageTiles() { | 1401 void ThreadProxy::DidManageTiles() { |
| 1408 DCHECK(IsImplThread()); | 1402 DCHECK(IsImplThread()); |
| 1409 impl().scheduler->DidManageTiles(); | 1403 impl().scheduler->DidManageTiles(); |
| 1410 } | 1404 } |
| 1411 | 1405 |
| 1412 } // namespace cc | 1406 } // namespace cc |
| OLD | NEW |