Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index aff281fb3c1993fb2fa438927ee58e131ed1dd55..1592f295257cc5ab921c904e4167391125fbe852 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -52,17 +52,18 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layer_tree_host, |
manage_tiles_pending_(false), |
weak_factory_on_impl_thread_(this), |
weak_factory_(this), |
- begin_frame_completion_event_on_impl_thread_(NULL), |
+ begin_main_frame_completion_event_on_impl_thread_(NULL), |
readback_request_on_impl_thread_(NULL), |
commit_completion_event_on_impl_thread_(NULL), |
completion_event_for_commit_held_on_tree_activation_(NULL), |
texture_acquisition_completion_event_on_impl_thread_(NULL), |
next_frame_is_newly_committed_frame_on_impl_thread_(false), |
- render_vsync_enabled_(layer_tree_host->settings().render_vsync_enabled), |
- render_vsync_notification_enabled_( |
- layer_tree_host->settings().render_vsync_notification_enabled), |
- synchronously_disable_vsync_( |
- layer_tree_host->settings().synchronously_disable_vsync), |
+ throttle_frame_production_( |
+ layer_tree_host->settings().throttle_frame_production), |
+ render_parent_drives_begin_impl_frame__( |
+ layer_tree_host->settings().render_parent_drives_begin_impl_frame_), |
+ using_synchronous_renderer_compositor_( |
+ layer_tree_host->settings().using_synchronous_renderer_compositor), |
vsync_client_(NULL), |
inside_draw_(false), |
defer_commits_(false), |
@@ -92,15 +93,15 @@ bool ThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { |
// Perform a synchronous commit. |
{ |
DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
- CompletionEvent begin_frame_completion; |
+ CompletionEvent begin_main_frame_completion; |
Proxy::ImplThread()->PostTask( |
- base::Bind(&ThreadProxy::ForceBeginFrameOnImplThread, |
+ base::Bind(&ThreadProxy::ForceBeginMainFrameOnImplThread, |
impl_thread_weak_ptr_, |
- &begin_frame_completion)); |
- begin_frame_completion.Wait(); |
+ &begin_main_frame_completion)); |
+ begin_main_frame_completion.Wait(); |
} |
in_composite_and_readback_ = true; |
- BeginFrame(scoped_ptr<BeginFrameAndCommitState>()); |
+ BeginMainFrame(scoped_ptr<BeginMainFrameAndCommitState>()); |
in_composite_and_readback_ = false; |
// Perform a synchronous readback. |
@@ -326,9 +327,9 @@ void ThreadProxy::OnVSyncParametersChanged(base::TimeTicks timebase, |
scheduler_on_impl_thread_->SetTimebaseAndInterval(timebase, interval); |
} |
-void ThreadProxy::DidVSync(base::TimeTicks frame_time) { |
+void ThreadProxy::DidBeginImplFrame(base::TimeTicks frame_time) { |
DCHECK(IsImplThread()); |
- TRACE_EVENT0("cc", "ThreadProxy::DidVSync"); |
+ TRACE_EVENT0("cc", "ThreadProxy::DidBeginImplFrame"); |
if (vsync_client_) |
vsync_client_->DidVSync(frame_time); |
} |
@@ -338,7 +339,7 @@ void ThreadProxy::RequestVSyncNotification(VSyncClient* client) { |
TRACE_EVENT1( |
"cc", "ThreadProxy::RequestVSyncNotification", "enable", !!client); |
vsync_client_ = client; |
- layer_tree_host_impl_->EnableVSyncNotification(!!client); |
+ layer_tree_host_impl_->SetNeedsBeginImplFrame(!!client); |
} |
void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
@@ -473,7 +474,7 @@ void ThreadProxy::SetDeferCommits(bool defer_commits) { |
if (!defer_commits_ && pending_deferred_commit_) |
Proxy::MainThread()->PostTask( |
- base::Bind(&ThreadProxy::BeginFrame, |
+ base::Bind(&ThreadProxy::BeginMainFrame, |
main_thread_weak_ptr_, |
base::Passed(&pending_deferred_commit_))); |
} |
@@ -603,9 +604,9 @@ void ThreadProxy::FinishAllRenderingOnImplThread(CompletionEvent* completion) { |
completion->Signal(); |
} |
-void ThreadProxy::ForceBeginFrameOnImplThread(CompletionEvent* completion) { |
- TRACE_EVENT0("cc", "ThreadProxy::ForceBeginFrameOnImplThread"); |
- DCHECK(!begin_frame_completion_event_on_impl_thread_); |
+void ThreadProxy::ForceBeginMainFrameOnImplThread(CompletionEvent* completion) { |
+ TRACE_EVENT0("cc", "ThreadProxy::ForceBeginMainFrameOnImplThread"); |
+ DCHECK(!begin_main_frame_completion_event_on_impl_thread_); |
SetNeedsForcedCommitOnImplThread(); |
if (scheduler_on_impl_thread_->CommitPending()) { |
@@ -613,44 +614,46 @@ void ThreadProxy::ForceBeginFrameOnImplThread(CompletionEvent* completion) { |
return; |
} |
- begin_frame_completion_event_on_impl_thread_ = completion; |
+ begin_main_frame_completion_event_on_impl_thread_ = completion; |
} |
-void ThreadProxy::ScheduledActionBeginFrame() { |
- TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginFrame"); |
- scoped_ptr<BeginFrameAndCommitState> begin_frame_state( |
- new BeginFrameAndCommitState); |
- begin_frame_state->monotonic_frame_begin_time = base::TimeTicks::Now(); |
- begin_frame_state->scroll_info = layer_tree_host_impl_->ProcessScrollDeltas(); |
+void ThreadProxy::ScheduledActionBeginMainFrame() { |
+ TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginMainFrame"); |
+ scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( |
+ new BeginMainFrameAndCommitState); |
+ begin_main_frame_state->monotonic_frame_begin_time = base::TimeTicks::Now(); |
+ begin_main_frame_state->scroll_info = |
+ layer_tree_host_impl_->ProcessScrollDeltas(); |
DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); |
- begin_frame_state->memory_allocation_limit_bytes = |
+ begin_main_frame_state->memory_allocation_limit_bytes = |
layer_tree_host_impl_->memory_allocation_limit_bytes(); |
- Proxy::MainThread()->PostTask(base::Bind(&ThreadProxy::BeginFrame, |
- main_thread_weak_ptr_, |
- base::Passed(&begin_frame_state))); |
+ Proxy::MainThread()->PostTask( |
+ base::Bind(&ThreadProxy::BeginMainFrame, |
+ main_thread_weak_ptr_, |
+ base::Passed(&begin_main_frame_state))); |
- if (begin_frame_completion_event_on_impl_thread_) { |
- begin_frame_completion_event_on_impl_thread_->Signal(); |
- begin_frame_completion_event_on_impl_thread_ = NULL; |
+ if (begin_main_frame_completion_event_on_impl_thread_) { |
+ begin_main_frame_completion_event_on_impl_thread_->Signal(); |
+ begin_main_frame_completion_event_on_impl_thread_ = NULL; |
} |
} |
-void ThreadProxy::BeginFrame( |
- scoped_ptr<BeginFrameAndCommitState> begin_frame_state) { |
- TRACE_EVENT0("cc", "ThreadProxy::BeginFrame"); |
+void ThreadProxy::BeginMainFrame( |
+ scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
+ TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); |
DCHECK(IsMainThread()); |
if (!layer_tree_host_) |
return; |
if (defer_commits_) { |
- pending_deferred_commit_ = begin_frame_state.Pass(); |
+ pending_deferred_commit_ = begin_main_frame_state.Pass(); |
layer_tree_host_->DidDeferCommit(); |
TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); |
return; |
} |
// Do not notify the impl thread of commit requests that occur during |
- // the apply/animate/layout part of the BeginFrameAndCommit process since |
+ // the apply/animate/layout part of the BeginMainFrameAndCommit process since |
// those commit requests will get painted immediately. Once we have done |
// the paint, commit_requested_ will be set to false to allow new commit |
// requests to be scheduled. |
@@ -662,8 +665,8 @@ void ThreadProxy::BeginFrame( |
// callbacks will trigger another frame. |
animate_requested_ = false; |
- if (begin_frame_state) |
- layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); |
+ if (begin_main_frame_state) |
+ layer_tree_host_->ApplyScrollAndScale(*begin_main_frame_state->scroll_info); |
if (!in_composite_and_readback_ && !layer_tree_host_->visible()) { |
commit_requested_ = false; |
@@ -671,17 +674,18 @@ void ThreadProxy::BeginFrame( |
TRACE_EVENT0("cc", "EarlyOut_NotVisible"); |
Proxy::ImplThread()->PostTask(base::Bind( |
- &ThreadProxy::BeginFrameAbortedOnImplThread, impl_thread_weak_ptr_)); |
+ &ThreadProxy::BeginMainFrameAbortedOnImplThread, |
+ impl_thread_weak_ptr_)); |
return; |
} |
- layer_tree_host_->WillBeginFrame(); |
+ layer_tree_host_->WillBeginMainFrame(); |
- if (begin_frame_state) { |
+ if (begin_main_frame_state) { |
layer_tree_host_->UpdateClientAnimations( |
- begin_frame_state->monotonic_frame_begin_time); |
+ begin_main_frame_state->monotonic_frame_begin_time); |
layer_tree_host_->AnimateLayers( |
- begin_frame_state->monotonic_frame_begin_time); |
+ begin_main_frame_state->monotonic_frame_begin_time); |
} |
// Unlink any backings that the impl thread has evicted, so that we know to |
@@ -703,8 +707,8 @@ void ThreadProxy::BeginFrame( |
make_scoped_ptr(new ResourceUpdateQueue); |
layer_tree_host_->UpdateLayers( |
queue.get(), |
- begin_frame_state ? begin_frame_state->memory_allocation_limit_bytes |
- : 0u); |
+ begin_main_frame_state ? |
+ begin_main_frame_state->memory_allocation_limit_bytes : 0u); |
// Once single buffered layers are committed, they cannot be modified until |
// they are drawn by the impl thread. |
@@ -731,12 +735,12 @@ void ThreadProxy::BeginFrame( |
created_offscreen_context_provider_ = true; |
} |
- // Notify the impl thread that the BeginFrame has completed. This will |
+ // Notify the impl thread that the BeginMainFrame has completed. This will |
// begin the commit process, which is blocking from the main thread's |
// point of view, but asynchronously performed on the impl thread, |
// coordinated by the Scheduler. |
{ |
- TRACE_EVENT0("cc", "ThreadProxy::BeginFrame::commit"); |
+ TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame::commit"); |
DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
@@ -746,7 +750,7 @@ void ThreadProxy::BeginFrame( |
CompletionEvent completion; |
Proxy::ImplThread()->PostTask( |
- base::Bind(&ThreadProxy::BeginFrameCompleteOnImplThread, |
+ base::Bind(&ThreadProxy::BeginMainFrameCompleteOnImplThread, |
impl_thread_weak_ptr_, |
&completion, |
queue.release(), |
@@ -758,16 +762,16 @@ void ThreadProxy::BeginFrame( |
} |
layer_tree_host_->CommitComplete(); |
- layer_tree_host_->DidBeginFrame(); |
+ layer_tree_host_->DidBeginMainFrame(); |
} |
-void ThreadProxy::BeginFrameCompleteOnImplThread( |
+void ThreadProxy::BeginMainFrameCompleteOnImplThread( |
CompletionEvent* completion, |
ResourceUpdateQueue* raw_queue, |
scoped_refptr<cc::ContextProvider> offscreen_context_provider) { |
scoped_ptr<ResourceUpdateQueue> queue(raw_queue); |
- TRACE_EVENT0("cc", "ThreadProxy::BeginFrameCompleteOnImplThread"); |
+ TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrameCompleteOnImplThread"); |
DCHECK(!commit_completion_event_on_impl_thread_); |
DCHECK(IsImplThread() && IsMainThreadBlocked()); |
DCHECK(scheduler_on_impl_thread_); |
@@ -809,13 +813,13 @@ void ThreadProxy::BeginFrameCompleteOnImplThread( |
commit_completion_event_on_impl_thread_ = completion; |
} |
-void ThreadProxy::BeginFrameAbortedOnImplThread() { |
- TRACE_EVENT0("cc", "ThreadProxy::BeginFrameAbortedOnImplThread"); |
+void ThreadProxy::BeginMainFrameAbortedOnImplThread() { |
+ TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread"); |
DCHECK(IsImplThread()); |
DCHECK(scheduler_on_impl_thread_); |
DCHECK(scheduler_on_impl_thread_->CommitPending()); |
- scheduler_on_impl_thread_->BeginFrameAborted(); |
+ scheduler_on_impl_thread_->BeginMainFrameAborted(); |
} |
void ThreadProxy::ScheduledActionCommit() { |
@@ -941,7 +945,7 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) { |
if (draw_frame) { |
layer_tree_host_impl_->DrawLayers( |
&frame, |
- scheduler_on_impl_thread_->LastVSyncTime()); |
+ scheduler_on_impl_thread_->LastBeginImplFrameTime()); |
result.did_draw = true; |
} |
layer_tree_host_impl_->DidDrawAllLayers(frame); |
@@ -1038,7 +1042,7 @@ void ThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
void ThreadProxy::ReadyToFinalizeTextureUpdates() { |
DCHECK(IsImplThread()); |
- scheduler_on_impl_thread_->BeginFrameComplete(); |
+ scheduler_on_impl_thread_->BeginMainFrameComplete(); |
} |
void ThreadProxy::DidCommitAndDrawFrame() { |
@@ -1110,12 +1114,12 @@ void ThreadProxy::InitializeImplOnImplThread( |
base::Time::kMicrosecondsPerSecond / |
layer_tree_host_->settings().refresh_rate); |
scoped_ptr<FrameRateController> frame_rate_controller; |
- if (render_vsync_enabled_) { |
- if (render_vsync_notification_enabled_) { |
+ if (throttle_frame_production_) { |
+ if (render_parent_drives_begin_impl_frame__) { |
frame_rate_controller.reset( |
new FrameRateController(VSyncTimeSource::Create( |
this, |
- synchronously_disable_vsync_ ? |
+ using_synchronous_renderer_compositor_ ? |
VSyncTimeSource::DISABLE_SYNCHRONOUSLY : |
VSyncTimeSource::DISABLE_ON_NEXT_TICK))); |
} else { |
@@ -1206,7 +1210,7 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
DCHECK(IsImplThread()); |
layer_tree_host_->DeleteContentsTexturesOnImplThread( |
layer_tree_host_impl_->resource_provider()); |
- layer_tree_host_impl_->EnableVSyncNotification(false); |
+ layer_tree_host_impl_->SetNeedsBeginImplFrame(false); |
input_handler_client_on_impl_thread_.reset(); |
scheduler_on_impl_thread_.reset(); |
layer_tree_host_impl_.reset(); |
@@ -1219,10 +1223,10 @@ size_t ThreadProxy::MaxPartialTextureUpdates() const { |
return ResourceUpdateController::MaxPartialTextureUpdates(); |
} |
-ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
+ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() |
: memory_allocation_limit_bytes(0) {} |
-ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() {} |
+ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {} |
scoped_ptr<base::Value> ThreadProxy::AsValue() const { |
scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
@@ -1368,11 +1372,12 @@ void ThreadProxy::StartScrollbarAnimationOnImplThread() { |
layer_tree_host_impl_->CurrentFrameTimeTicks()); |
} |
-void ThreadProxy::DidReceiveLastInputEventForVSync( |
+void ThreadProxy::DidReceiveLastInputEventForBeginImplFrame( |
base::TimeTicks frame_time) { |
- if (render_vsync_notification_enabled_) { |
- TRACE_EVENT0("cc", "ThreadProxy::DidReceiveLastInputEventForVSync"); |
- DidVSync(frame_time); |
+ if (render_parent_drives_begin_impl_frame__) { |
+ TRACE_EVENT0("cc", |
+ "ThreadProxy::DidReceiveLastInputEventForBeginImplFrame"); |
+ DidBeginImplFrame(frame_time); |
} |
} |