| 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 } | 977 } |
| 978 | 978 |
| 979 layer_tree_host()->CommitComplete(); | 979 layer_tree_host()->CommitComplete(); |
| 980 layer_tree_host()->DidBeginMainFrame(); | 980 layer_tree_host()->DidBeginMainFrame(); |
| 981 } | 981 } |
| 982 | 982 |
| 983 void ThreadProxy::StartCommitOnImplThread( | 983 void ThreadProxy::StartCommitOnImplThread( |
| 984 CompletionEvent* completion, | 984 CompletionEvent* completion, |
| 985 ResourceUpdateQueue* raw_queue, | 985 ResourceUpdateQueue* raw_queue, |
| 986 scoped_refptr<ContextProvider> offscreen_context_provider) { | 986 scoped_refptr<ContextProvider> offscreen_context_provider) { |
| 987 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); | |
| 988 | |
| 989 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); | 987 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); |
| 990 DCHECK(!impl().commit_completion_event); | 988 DCHECK(!impl().commit_completion_event); |
| 991 DCHECK(IsImplThread() && IsMainThreadBlocked()); | 989 DCHECK(IsImplThread() && IsMainThreadBlocked()); |
| 992 DCHECK(impl().scheduler); | 990 DCHECK(impl().scheduler); |
| 993 DCHECK(impl().scheduler->CommitPending()); | 991 DCHECK(impl().scheduler->CommitPending()); |
| 994 | 992 |
| 995 if (!impl().layer_tree_host_impl) { | 993 if (!impl().layer_tree_host_impl) { |
| 996 TRACE_EVENT_INSTANT0( | 994 TRACE_EVENT_INSTANT0( |
| 997 "cc", "EarlyOut_NoLayerTree", TRACE_EVENT_SCOPE_THREAD); | 995 "cc", "EarlyOut_NoLayerTree", TRACE_EVENT_SCOPE_THREAD); |
| 998 completion->Signal(); | 996 completion->Signal(); |
| 999 return; | 997 return; |
| 1000 } | 998 } |
| 1001 | 999 |
| 1002 // Ideally, we should inform to impl thread when BeginMainFrame is started. | 1000 // Ideally, we should inform to impl thread when BeginMainFrame is started. |
| 1003 // But, we can avoid a PostTask in here. | 1001 // But, we can avoid a PostTask in here. |
| 1004 impl().scheduler->NotifyBeginMainFrameStarted(); | 1002 impl().scheduler->NotifyBeginMainFrameStarted(); |
| 1005 | 1003 |
| 1004 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); |
| 1005 |
| 1006 if (offscreen_context_provider.get()) | 1006 if (offscreen_context_provider.get()) |
| 1007 offscreen_context_provider->BindToCurrentThread(); | 1007 offscreen_context_provider->BindToCurrentThread(); |
| 1008 impl().layer_tree_host_impl->SetOffscreenContextProvider( | 1008 impl().layer_tree_host_impl->SetOffscreenContextProvider( |
| 1009 offscreen_context_provider); | 1009 offscreen_context_provider); |
| 1010 | 1010 |
| 1011 if (impl().contents_texture_manager) { | 1011 if (impl().contents_texture_manager) { |
| 1012 DCHECK_EQ(impl().contents_texture_manager, | 1012 DCHECK_EQ(impl().contents_texture_manager, |
| 1013 blocked_main().contents_texture_manager()); | 1013 blocked_main().contents_texture_manager()); |
| 1014 } else { | 1014 } else { |
| 1015 // Cache this pointer that was created on the main thread side to avoid a | 1015 // Cache this pointer that was created on the main thread side to avoid a |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 completion->Signal(); | 1458 completion->Signal(); |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1461 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
| 1462 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1462 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
| 1463 DCHECK(IsImplThread()); | 1463 DCHECK(IsImplThread()); |
| 1464 impl().layer_tree_host_impl = | 1464 impl().layer_tree_host_impl = |
| 1465 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1465 layer_tree_host()->CreateLayerTreeHostImpl(this); |
| 1466 const LayerTreeSettings& settings = layer_tree_host()->settings(); | 1466 const LayerTreeSettings& settings = layer_tree_host()->settings(); |
| 1467 SchedulerSettings scheduler_settings; | 1467 SchedulerSettings scheduler_settings; |
| 1468 scheduler_settings.main_frame_before_draw_enabled = |
| 1469 settings.main_frame_before_draw_enabled; |
| 1470 scheduler_settings.main_frame_before_activation_enabled = |
| 1471 settings.main_frame_before_activation_enabled; |
| 1468 scheduler_settings.impl_side_painting = settings.impl_side_painting; | 1472 scheduler_settings.impl_side_painting = settings.impl_side_painting; |
| 1469 scheduler_settings.timeout_and_draw_when_animation_checkerboards = | 1473 scheduler_settings.timeout_and_draw_when_animation_checkerboards = |
| 1470 settings.timeout_and_draw_when_animation_checkerboards; | 1474 settings.timeout_and_draw_when_animation_checkerboards; |
| 1471 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = | 1475 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = |
| 1472 settings.maximum_number_of_failed_draws_before_draw_is_forced_; | 1476 settings.maximum_number_of_failed_draws_before_draw_is_forced_; |
| 1473 scheduler_settings.using_synchronous_renderer_compositor = | 1477 scheduler_settings.using_synchronous_renderer_compositor = |
| 1474 settings.using_synchronous_renderer_compositor; | 1478 settings.using_synchronous_renderer_compositor; |
| 1475 scheduler_settings.throttle_frame_production = | 1479 scheduler_settings.throttle_frame_production = |
| 1476 settings.throttle_frame_production; | 1480 settings.throttle_frame_production; |
| 1477 impl().scheduler = | 1481 impl().scheduler = |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1728 | 1732 |
| 1729 impl().timing_history.DidActivatePendingTree(); | 1733 impl().timing_history.DidActivatePendingTree(); |
| 1730 } | 1734 } |
| 1731 | 1735 |
| 1732 void ThreadProxy::DidManageTiles() { | 1736 void ThreadProxy::DidManageTiles() { |
| 1733 DCHECK(IsImplThread()); | 1737 DCHECK(IsImplThread()); |
| 1734 impl().scheduler->DidManageTiles(); | 1738 impl().scheduler->DidManageTiles(); |
| 1735 } | 1739 } |
| 1736 | 1740 |
| 1737 } // namespace cc | 1741 } // namespace cc |
| OLD | NEW |