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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/base/thread.h" | 10 #include "cc/base/thread.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 weak_factory_on_impl_thread_(this), | 53 weak_factory_on_impl_thread_(this), |
54 weak_factory_(this), | 54 weak_factory_(this), |
55 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_(NULL), | 55 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_(NULL), |
56 readback_request_on_impl_thread_(NULL), | 56 readback_request_on_impl_thread_(NULL), |
57 commit_completion_event_on_impl_thread_(NULL), | 57 commit_completion_event_on_impl_thread_(NULL), |
58 completion_event_for_commit_held_on_tree_activation_(NULL), | 58 completion_event_for_commit_held_on_tree_activation_(NULL), |
59 texture_acquisition_completion_event_on_impl_thread_(NULL), | 59 texture_acquisition_completion_event_on_impl_thread_(NULL), |
60 next_frame_is_newly_committed_frame_on_impl_thread_(false), | 60 next_frame_is_newly_committed_frame_on_impl_thread_(false), |
61 throttle_frame_production_( | 61 throttle_frame_production_( |
62 layer_tree_host->settings().throttle_frame_production), | 62 layer_tree_host->settings().throttle_frame_production), |
63 render_parent_drives_begin_frame__( | 63 begin_frame_scheduling_enabled_( |
64 layer_tree_host->settings().render_parent_drives_begin_frame_), | 64 layer_tree_host->settings().begin_frame_scheduling_enabled), |
65 using_synchronous_renderer_compositor_( | 65 using_synchronous_renderer_compositor_( |
66 layer_tree_host->settings().using_synchronous_renderer_compositor), | 66 layer_tree_host->settings().using_synchronous_renderer_compositor), |
67 vsync_client_(NULL), | 67 vsync_client_(NULL), |
68 inside_draw_(false), | 68 inside_draw_(false), |
69 defer_commits_(false), | 69 defer_commits_(false), |
70 renew_tree_priority_on_impl_thread_pending_(false) { | 70 renew_tree_priority_on_impl_thread_pending_(false) { |
71 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); | 71 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); |
72 DCHECK(IsMainThread()); | 72 DCHECK(IsMainThread()); |
73 DCHECK(layer_tree_host_); | 73 DCHECK(layer_tree_host_); |
74 } | 74 } |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1109 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
1110 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1110 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
1111 DCHECK(IsImplThread()); | 1111 DCHECK(IsImplThread()); |
1112 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); | 1112 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); |
1113 const base::TimeDelta display_refresh_interval = | 1113 const base::TimeDelta display_refresh_interval = |
1114 base::TimeDelta::FromMicroseconds( | 1114 base::TimeDelta::FromMicroseconds( |
1115 base::Time::kMicrosecondsPerSecond / | 1115 base::Time::kMicrosecondsPerSecond / |
1116 layer_tree_host_->settings().refresh_rate); | 1116 layer_tree_host_->settings().refresh_rate); |
1117 scoped_ptr<FrameRateController> frame_rate_controller; | 1117 scoped_ptr<FrameRateController> frame_rate_controller; |
1118 if (throttle_frame_production_) { | 1118 if (throttle_frame_production_) { |
1119 if (render_parent_drives_begin_frame__) { | 1119 if (begin_frame_scheduling_enabled_) { |
1120 frame_rate_controller.reset( | 1120 frame_rate_controller.reset( |
1121 new FrameRateController(VSyncTimeSource::Create( | 1121 new FrameRateController(VSyncTimeSource::Create( |
1122 this, | 1122 this, |
1123 using_synchronous_renderer_compositor_ ? | 1123 using_synchronous_renderer_compositor_ ? |
1124 VSyncTimeSource::DISABLE_SYNCHRONOUSLY : | 1124 VSyncTimeSource::DISABLE_SYNCHRONOUSLY : |
1125 VSyncTimeSource::DISABLE_ON_NEXT_TICK))); | 1125 VSyncTimeSource::DISABLE_ON_NEXT_TICK))); |
1126 } else { | 1126 } else { |
1127 frame_rate_controller.reset( | 1127 frame_rate_controller.reset( |
1128 new FrameRateController(DelayBasedTimeSource::Create( | 1128 new FrameRateController(DelayBasedTimeSource::Create( |
1129 display_refresh_interval, Proxy::ImplThread()))); | 1129 display_refresh_interval, Proxy::ImplThread()))); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 delay); | 1362 delay); |
1363 } | 1363 } |
1364 | 1364 |
1365 void ThreadProxy::StartScrollbarAnimationOnImplThread() { | 1365 void ThreadProxy::StartScrollbarAnimationOnImplThread() { |
1366 layer_tree_host_impl_->StartScrollbarAnimation( | 1366 layer_tree_host_impl_->StartScrollbarAnimation( |
1367 layer_tree_host_impl_->CurrentFrameTimeTicks()); | 1367 layer_tree_host_impl_->CurrentFrameTimeTicks()); |
1368 } | 1368 } |
1369 | 1369 |
1370 void ThreadProxy::DidReceiveLastInputEventForBeginFrameOnImplThread( | 1370 void ThreadProxy::DidReceiveLastInputEventForBeginFrameOnImplThread( |
1371 base::TimeTicks frame_time) { | 1371 base::TimeTicks frame_time) { |
1372 if (render_parent_drives_begin_frame__) { | 1372 if (begin_frame_scheduling_enabled_) { |
1373 TRACE_EVENT0("cc", | 1373 TRACE_EVENT0("cc", |
1374 "ThreadProxy::DidReceiveLastInputEventForBeginFrameOnImplThread"); | 1374 "ThreadProxy::DidReceiveLastInputEventForBeginFrameOnImplThread"); |
1375 BeginFrameOnImplThread(frame_time); | 1375 BeginFrameOnImplThread(frame_time); |
1376 } | 1376 } |
1377 } | 1377 } |
1378 | 1378 |
1379 void ThreadProxy::DidActivatePendingTree() { | 1379 void ThreadProxy::DidActivatePendingTree() { |
1380 DCHECK(IsImplThread()); | 1380 DCHECK(IsImplThread()); |
1381 TRACE_EVENT0("cc", "ThreadProxy::DidActivatePendingTreeOnImplThread"); | 1381 TRACE_EVENT0("cc", "ThreadProxy::DidActivatePendingTreeOnImplThread"); |
1382 | 1382 |
1383 if (completion_event_for_commit_held_on_tree_activation_ && | 1383 if (completion_event_for_commit_held_on_tree_activation_ && |
1384 !layer_tree_host_impl_->pending_tree()) { | 1384 !layer_tree_host_impl_->pending_tree()) { |
1385 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1385 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
1386 TRACE_EVENT_SCOPE_THREAD); | 1386 TRACE_EVENT_SCOPE_THREAD); |
1387 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1387 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1388 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1388 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1389 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1389 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1390 } | 1390 } |
1391 } | 1391 } |
1392 | 1392 |
1393 } // namespace cc | 1393 } // namespace cc |
OLD | NEW |