Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: cc/trees/thread_proxy.cc

Issue 15836005: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 7d7a888ea6a2266cedd32e1c202235d1b9278224..7e319c5ae31171aa87e8070adc26ad9b214fc82d 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -16,7 +16,6 @@
#include "cc/scheduler/delay_based_time_source.h"
#include "cc/scheduler/frame_rate_controller.h"
#include "cc/scheduler/scheduler.h"
-#include "cc/scheduler/vsync_time_source.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
@@ -64,7 +63,6 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layer_tree_host,
layer_tree_host->settings().begin_frame_scheduling_enabled),
using_synchronous_renderer_compositor_(
layer_tree_host->settings().using_synchronous_renderer_compositor),
- vsync_client_(NULL),
inside_draw_(false),
defer_commits_(false),
renew_tree_priority_on_impl_thread_pending_(false) {
@@ -328,36 +326,21 @@ void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() {
void ThreadProxy::OnSwapBuffersCompleteOnImplThread() {
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread");
- scheduler_on_impl_thread_->DidSwapBuffersComplete();
Proxy::MainThread()->PostTask(
base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_));
}
-void ThreadProxy::OnVSyncParametersChanged(base::TimeTicks timebase,
- base::TimeDelta interval) {
+void ThreadProxy::SetNeedsBeginFrameOnImplThread(bool enable) {
DCHECK(IsImplThread());
- TRACE_EVENT2("cc",
- "ThreadProxy::OnVSyncParametersChanged",
- "timebase",
- (timebase - base::TimeTicks()).InMilliseconds(),
- "interval",
- interval.InMilliseconds());
- scheduler_on_impl_thread_->SetTimebaseAndInterval(timebase, interval);
+ TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrameOnImplThread",
+ "enable", enable);
+ layer_tree_host_impl_->SetNeedsBeginFrame(enable);
}
void ThreadProxy::BeginFrameOnImplThread(base::TimeTicks frame_time) {
DCHECK(IsImplThread());
- TRACE_EVENT0("cc", "ThreadProxy::OnBeginFrameOnImplThread");
- if (vsync_client_)
- vsync_client_->DidVSync(frame_time);
-}
-
-void ThreadProxy::RequestVSyncNotification(VSyncClient* client) {
- DCHECK(IsImplThread());
- TRACE_EVENT1(
- "cc", "ThreadProxy::RequestVSyncNotification", "enable", !!client);
- vsync_client_ = client;
- layer_tree_host_impl_->SetNeedsBeginFrame(!!client);
+ TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnImplThread");
+ scheduler_on_impl_thread_->BeginFrame(frame_time);
}
void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
@@ -1110,35 +1093,15 @@ void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) {
TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread");
DCHECK(IsImplThread());
layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
- const base::TimeDelta display_refresh_interval =
- base::TimeDelta::FromMicroseconds(
- base::Time::kMicrosecondsPerSecond /
- layer_tree_host_->settings().refresh_rate);
- scoped_ptr<FrameRateController> frame_rate_controller;
- if (throttle_frame_production_) {
- if (begin_frame_scheduling_enabled_) {
- frame_rate_controller.reset(
- new FrameRateController(VSyncTimeSource::Create(
- this,
- using_synchronous_renderer_compositor_ ?
- VSyncTimeSource::DISABLE_SYNCHRONOUSLY :
- VSyncTimeSource::DISABLE_ON_NEXT_TICK)));
- } else {
- frame_rate_controller.reset(
- new FrameRateController(DelayBasedTimeSource::Create(
- display_refresh_interval, Proxy::ImplThread())));
- }
- } else {
- frame_rate_controller.reset(new FrameRateController(Proxy::ImplThread()));
- }
const LayerTreeSettings& settings = layer_tree_host_->settings();
SchedulerSettings scheduler_settings;
scheduler_settings.impl_side_painting = settings.impl_side_painting;
scheduler_settings.timeout_and_draw_when_animation_checkerboards =
settings.timeout_and_draw_when_animation_checkerboards;
- scheduler_on_impl_thread_ = Scheduler::Create(this,
- frame_rate_controller.Pass(),
- scheduler_settings);
+ scheduler_settings.using_synchronous_renderer_compositor =
+ settings.using_synchronous_renderer_compositor;
+ scheduler_on_impl_thread_ =
+ Scheduler::Create(this, scheduler_settings, Proxy::ImplThread());
scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
impl_thread_weak_ptr_ = weak_factory_on_impl_thread_.GetWeakPtr();
@@ -1167,19 +1130,6 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread(
if (*success) {
*capabilities = layer_tree_host_impl_->GetRendererCapabilities();
- scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported(
- capabilities->using_swap_complete_callback);
-
- OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface();
- DCHECK(output_surface_ptr);
- int max_frames_pending =
- output_surface_ptr->capabilities().max_frames_pending;
- if (max_frames_pending <= 0)
- max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
- if (output_surface_ptr->capabilities().has_parent_compositor)
- max_frames_pending = 1;
-
- scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending);
if (layer_tree_host_impl_->resource_provider())
layer_tree_host_impl_->resource_provider()->
@@ -1210,7 +1160,6 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
scheduler_on_impl_thread_.reset();
layer_tree_host_impl_.reset();
weak_factory_on_impl_thread_.InvalidateWeakPtrs();
- vsync_client_ = NULL;
completion->Signal();
}
@@ -1362,11 +1311,6 @@ void ThreadProxy::RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) {
delay);
}
-void ThreadProxy::StartScrollbarAnimationOnImplThread() {
- layer_tree_host_impl_->StartScrollbarAnimation(
- layer_tree_host_impl_->CurrentFrameTimeTicks());
-}
-
void ThreadProxy::DidReceiveLastInputEventForBeginFrameOnImplThread(
base::TimeTicks frame_time) {
if (begin_frame_scheduling_enabled_) {
@@ -1376,6 +1320,11 @@ void ThreadProxy::DidReceiveLastInputEventForBeginFrameOnImplThread(
}
}
+void ThreadProxy::StartScrollbarAnimationOnImplThread() {
brianderson 2013/06/01 04:30:29 not sure why i moved this. will put it back.
+ layer_tree_host_impl_->StartScrollbarAnimation(
+ layer_tree_host_impl_->CurrentFrameTimeTicks());
+}
+
void ThreadProxy::DidActivatePendingTree() {
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::DidActivatePendingTreeOnImplThread");

Powered by Google App Engine
This is Rietveld 408576698