diff options
author | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-12 01:07:15 +0000 |
---|---|---|
committer | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-12 01:07:15 +0000 |
commit | 97e9ccd6a43b365d11972c81aeb3faa0c3aa3503 (patch) | |
tree | 37185307ead88a0267b40c4379a64d7db1da5cb8 /cc/test | |
parent | b4c49028da217cbf78d1876e69cbf7af07aa385d (diff) | |
download | chromium_src-97e9ccd6a43b365d11972c81aeb3faa0c3aa3503.zip chromium_src-97e9ccd6a43b365d11972c81aeb3faa0c3aa3503.tar.gz chromium_src-97e9ccd6a43b365d11972c81aeb3faa0c3aa3503.tar.bz2 |
cc: Handle retroactive BeginFrames in the Scheduler.
This will be the first step allowing us to pull logic out
of the OutputSurface.
Initially, the retroactive logic will exist in both the
OutputSurface and the scheduler. Then, as all logic that
depends on the retroactive logic has moved to the
scheduler, I will remove the retroactive logic in
OutputSurface.
There are now 4 BeginFrames in the scheduler:
1) BeginFrame: from the OutputSurface.
2) BeginRetroFrame: a deferred BeginFrame.
3) BeginImplFrame: starts a compositor frame.
4) BeginMainFrame: starts a main frame.
BUG=358409
Review URL: https://codereview.chromium.org/218633010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/fake_layer_tree_host_impl_client.h | 3 | ||||
-rw-r--r-- | cc/test/fake_output_surface.cc | 21 | ||||
-rw-r--r-- | cc/test/fake_output_surface.h | 10 | ||||
-rw-r--r-- | cc/test/fake_output_surface_client.cc | 4 | ||||
-rw-r--r-- | cc/test/fake_output_surface_client.h | 10 | ||||
-rw-r--r-- | cc/test/layer_tree_test.cc | 7 | ||||
-rw-r--r-- | cc/test/layer_tree_test.h | 2 |
7 files changed, 25 insertions, 32 deletions
diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h index 123a661..975992d 100644 --- a/cc/test/fake_layer_tree_host_impl_client.h +++ b/cc/test/fake_layer_tree_host_impl_client.h @@ -17,8 +17,7 @@ class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient { virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} virtual void DidSwapBuffersOnImplThread() OVERRIDE {} virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} - virtual void BeginImplFrame(const BeginFrameArgs& args) - OVERRIDE {} + virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE {} virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE {} virtual void NotifyReadyToActivate() OVERRIDE {} virtual void SetNeedsRedrawOnImplThread() OVERRIDE {} diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc index e72253c..920b689 100644 --- a/cc/test/fake_output_surface.cc +++ b/cc/test/fake_output_surface.cc @@ -19,7 +19,7 @@ FakeOutputSurface::FakeOutputSurface( : OutputSurface(context_provider), client_(NULL), num_sent_frames_(0), - needs_begin_impl_frame_(false), + needs_begin_frame_(false), forced_draw_to_software_device_(false), has_external_stencil_test_(false), fake_weak_ptr_factory_(this) { @@ -84,22 +84,23 @@ void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { } } -void FakeOutputSurface::SetNeedsBeginImplFrame(bool enable) { - needs_begin_impl_frame_ = enable; - OutputSurface::SetNeedsBeginImplFrame(enable); +void FakeOutputSurface::SetNeedsBeginFrame(bool enable) { + needs_begin_frame_ = enable; + OutputSurface::SetNeedsBeginFrame(enable); - // If there is not BeginImplFrame emulation from the FrameRateController, - // then we just post a BeginImplFrame to emulate it as part of the test. + // If there is not BeginFrame emulation from the FrameRateController, + // then we just post a BeginFrame to emulate it as part of the test. if (enable && !frame_rate_controller_) { base::MessageLoop::current()->PostDelayedTask( - FROM_HERE, base::Bind(&FakeOutputSurface::OnBeginImplFrame, - fake_weak_ptr_factory_.GetWeakPtr()), + FROM_HERE, + base::Bind(&FakeOutputSurface::OnBeginFrame, + fake_weak_ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(16)); } } -void FakeOutputSurface::OnBeginImplFrame() { - OutputSurface::BeginImplFrame(BeginFrameArgs::CreateForTesting()); +void FakeOutputSurface::OnBeginFrame() { + OutputSurface::BeginFrame(BeginFrameArgs::CreateForTesting()); } diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h index 965f543..e44153c 100644 --- a/cc/test/fake_output_surface.h +++ b/cc/test/fake_output_surface.h @@ -94,10 +94,8 @@ class FakeOutputSurface : public OutputSurface { virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE; - virtual void SetNeedsBeginImplFrame(bool enable) OVERRIDE; - bool needs_begin_impl_frame() const { - return needs_begin_impl_frame_; - } + virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; + bool needs_begin_frame() const { return needs_begin_frame_; } void set_forced_draw_to_software_device(bool forced) { forced_draw_to_software_device_ = forced; @@ -140,12 +138,12 @@ class FakeOutputSurface : public OutputSurface { scoped_ptr<SoftwareOutputDevice> software_device, bool delegated_rendering); - void OnBeginImplFrame(); + void OnBeginFrame(); OutputSurfaceClient* client_; CompositorFrame last_sent_frame_; size_t num_sent_frames_; - bool needs_begin_impl_frame_; + bool needs_begin_frame_; bool forced_draw_to_software_device_; bool has_external_stencil_test_; TransferableResourceArray resources_held_by_parent_; diff --git a/cc/test/fake_output_surface_client.cc b/cc/test/fake_output_surface_client.cc index ce4feef..20de00e 100644 --- a/cc/test/fake_output_surface_client.cc +++ b/cc/test/fake_output_surface_client.cc @@ -12,8 +12,8 @@ bool FakeOutputSurfaceClient::DeferredInitialize( return deferred_initialize_result_; } -void FakeOutputSurfaceClient::BeginImplFrame(const BeginFrameArgs& args) { - begin_impl_frame_count_++; +void FakeOutputSurfaceClient::BeginFrame(const BeginFrameArgs& args) { + begin_frame_count_++; } void FakeOutputSurfaceClient::DidLoseOutputSurface() { diff --git a/cc/test/fake_output_surface_client.h b/cc/test/fake_output_surface_client.h index b944d09..d64e063 100644 --- a/cc/test/fake_output_surface_client.h +++ b/cc/test/fake_output_surface_client.h @@ -13,7 +13,7 @@ namespace cc { class FakeOutputSurfaceClient : public OutputSurfaceClient { public: FakeOutputSurfaceClient() - : begin_impl_frame_count_(0), + : begin_frame_count_(0), deferred_initialize_result_(true), deferred_initialize_called_(false), did_lose_output_surface_called_(false), @@ -23,7 +23,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; virtual void ReleaseGL() OVERRIDE {} virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {} - virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE; + virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; virtual void DidSwapBuffers() OVERRIDE {} virtual void OnSwapBuffersComplete() OVERRIDE {} virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {} @@ -36,9 +36,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {} - int begin_impl_frame_count() { - return begin_impl_frame_count_; - } + int begin_frame_count() { return begin_frame_count_; } void set_deferred_initialize_result(bool result) { deferred_initialize_result_ = result; @@ -55,7 +53,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; } private: - int begin_impl_frame_count_; + int begin_frame_count_; bool deferred_initialize_result_; bool deferred_initialize_called_; bool did_lose_output_surface_called_; diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 69f42e0..ed8de34 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -83,10 +83,9 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { block_notify_ready_to_activate_for_testing_(false), notify_ready_to_activate_was_blocked_(false) {} - virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE { + virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE { + LayerTreeHostImpl::WillBeginImplFrame(args); test_hooks_->WillBeginImplFrameOnThread(this, args); - LayerTreeHostImpl::BeginImplFrame(args); - test_hooks_->DidBeginImplFrameOnThread(this, args); } virtual void BeginMainFrameAborted(bool did_handle) OVERRIDE { @@ -628,7 +627,7 @@ void LayerTreeTest::RunTest(bool threaded, delegating_renderer_ = delegating_renderer; - // Spend less time waiting for BeginImplFrame because the output is + // Spend less time waiting for BeginFrame because the output is // mocked out. settings_.refresh_rate = 200.0; if (impl_side_painting) { diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 86208f2..19a379b 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -36,8 +36,6 @@ class TestHooks : public AnimationDelegate { virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, const BeginFrameArgs& args) {} - virtual void DidBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, - const BeginFrameArgs& args) {} virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, bool did_handle) {} virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} |