summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonhong@chromium.org <simonhong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-12 04:26:02 +0000
committersimonhong@chromium.org <simonhong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-12 04:26:02 +0000
commit30d82149616dafe805d5fb22b1ddfcddfeee5a22 (patch)
tree7cb1d3ddc1559fd6ea094542343c768968433b67
parent370948a602ec072f7f5f0f6c285c88f49c4abd15 (diff)
downloadchromium_src-30d82149616dafe805d5fb22b1ddfcddfeee5a22.zip
chromium_src-30d82149616dafe805d5fb22b1ddfcddfeee5a22.tar.gz
chromium_src-30d82149616dafe805d5fb22b1ddfcddfeee5a22.tar.bz2
cc: Unify use of DidSwapBuffers() and did_request_swap
Use OutputSurface::DidSwapBuffers() as the source of whether we swapped or not. R=brianderson@chromium.org BUG=363414 TEST=cc_unittests Review URL: https://codereview.chromium.org/246753008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269738 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/cc.gyp2
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc75
-rw-r--r--cc/output/delegating_renderer_unittest.cc13
-rw-r--r--cc/scheduler/draw_result.h22
-rw-r--r--cc/scheduler/draw_swap_readback_result.h38
-rw-r--r--cc/scheduler/scheduler.cc22
-rw-r--r--cc/scheduler/scheduler.h10
-rw-r--r--cc/scheduler/scheduler_state_machine.cc53
-rw-r--r--cc/scheduler/scheduler_state_machine.h6
-rw-r--r--cc/scheduler/scheduler_state_machine_unittest.cc91
-rw-r--r--cc/scheduler/scheduler_unittest.cc49
-rw-r--r--cc/test/layer_tree_test.cc11
-rw-r--r--cc/test/layer_tree_test.h4
-rw-r--r--cc/trees/layer_tree_host_impl.cc27
-rw-r--r--cc/trees/layer_tree_host_impl.h11
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc203
-rw-r--r--cc/trees/layer_tree_host_unittest.cc44
-rw-r--r--cc/trees/layer_tree_host_unittest_animation.cc27
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc26
-rw-r--r--cc/trees/layer_tree_host_unittest_damage.cc48
-rw-r--r--cc/trees/layer_tree_host_unittest_delegated.cc6
-rw-r--r--cc/trees/layer_tree_host_unittest_video.cc9
-rw-r--r--cc/trees/thread_proxy.cc42
-rw-r--r--cc/trees/thread_proxy.h13
24 files changed, 376 insertions, 476 deletions
diff --git a/cc/cc.gyp b/cc/cc.gyp
index c7b1a50..3625c12 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -426,7 +426,7 @@
'resources/video_resource_updater.h',
'scheduler/delay_based_time_source.cc',
'scheduler/delay_based_time_source.h',
- 'scheduler/draw_swap_readback_result.h',
+ 'scheduler/draw_result.h',
'scheduler/scheduler.cc',
'scheduler/scheduler.h',
'scheduler/scheduler_settings.cc',
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index bf4b088..d418bb3 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -140,8 +140,7 @@ class DelegatedRendererLayerImplTestSimple
TEST_F(DelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
@@ -175,8 +174,7 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses) {
TEST_F(DelegatedRendererLayerImplTestSimple,
AddsQuadsToContributingRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
@@ -211,8 +209,7 @@ TEST_F(DelegatedRendererLayerImplTestSimple,
TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
@@ -240,8 +237,7 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass) {
TEST_F(DelegatedRendererLayerImplTestSimple,
QuadsFromRootRenderPassAreModifiedForTheTarget) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
@@ -274,8 +270,7 @@ TEST_F(DelegatedRendererLayerImplTestSimple,
TEST_F(DelegatedRendererLayerImplTestSimple, RenderPassTransformIsModified) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// The delegated layer has a surface between it and the root.
EXPECT_TRUE(delegated_renderer_layer_->render_target()->parent());
@@ -311,8 +306,7 @@ TEST_F(DelegatedRendererLayerImplTestSimple, RenderPassTransformIsModified) {
TEST_F(DelegatedRendererLayerImplTestSimple, DoesNotOwnARenderSurface) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// If the DelegatedRendererLayer is axis aligned and has opacity 1, then it
// has no need to be a RenderSurface for the quads it carries.
@@ -326,8 +320,7 @@ TEST_F(DelegatedRendererLayerImplTestSimple, DoesOwnARenderSurfaceForOpacity) {
delegated_renderer_layer_->SetOpacity(0.5f);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// This test case has quads from multiple layers in the delegated renderer, so
// if the DelegatedRendererLayer has opacity < 1, it should end up with a
@@ -345,8 +338,7 @@ TEST_F(DelegatedRendererLayerImplTestSimple,
delegated_renderer_layer_->SetTransform(rotation);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// This test case has quads from multiple layers in the delegated renderer, so
// if the DelegatedRendererLayer has opacity < 1, it should end up with a
@@ -368,8 +360,7 @@ class DelegatedRendererLayerImplTestOwnSurface
TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
@@ -408,8 +399,7 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses) {
TEST_F(DelegatedRendererLayerImplTestOwnSurface,
AddsQuadsToContributingRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
@@ -445,8 +435,7 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface,
TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
@@ -472,8 +461,7 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass) {
TEST_F(DelegatedRendererLayerImplTestOwnSurface,
QuadsFromRootRenderPassAreNotModifiedForTheTarget) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
@@ -706,8 +694,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_NoSurface) {
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -763,8 +750,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_NoSurface) {
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -829,8 +815,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_Surface) {
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -886,8 +871,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_Surface) {
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -1111,8 +1095,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1141,8 +1124,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1171,8 +1153,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1202,8 +1183,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1234,8 +1214,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(3u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1264,8 +1243,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(3u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1295,8 +1273,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(3u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1324,8 +1301,7 @@ TEST_F(DelegatedRendererLayerImplTestClip, QuadsClipped_LayerClipped_Surface) {
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(3u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
@@ -1389,8 +1365,7 @@ TEST_F(DelegatedRendererLayerImplTest, InvalidRenderPassDrawQuad) {
host_impl_->active_tree()->SetRootLayer(root_layer.Pass());
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
// The DelegatedRendererLayerImpl should drop the bad RenderPassDrawQuad.
ASSERT_EQ(1u, frame.render_passes.size());
diff --git a/cc/output/delegating_renderer_unittest.cc b/cc/output/delegating_renderer_unittest.cc
index a1d21d4..ac026ca 100644
--- a/cc/output/delegating_renderer_unittest.cc
+++ b/cc/output/delegating_renderer_unittest.cc
@@ -39,10 +39,10 @@ class DelegatingRendererTestDraw : public DelegatingRendererTest {
virtual void AfterTest() OVERRIDE {}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
EXPECT_EQ(0u, output_surface_->num_sent_frames());
const CompositorFrame& last_frame = output_surface_->last_sent_frame();
@@ -50,7 +50,7 @@ class DelegatingRendererTestDraw : public DelegatingRendererTest {
EXPECT_FALSE(last_frame.gl_frame_data);
EXPECT_EQ(0.f, last_frame.metadata.min_page_scale_factor);
EXPECT_EQ(0.f, last_frame.metadata.max_page_scale_factor);
- return DrawSwapReadbackResult::DRAW_SUCCESS;
+ return DRAW_SUCCESS;
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
@@ -89,10 +89,9 @@ class DelegatingRendererTestResources : public DelegatingRendererTest {
virtual void AfterTest() OVERRIDE {}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ virtual DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ DrawResult draw_result) OVERRIDE {
frame->render_passes.clear();
frame->render_passes_by_id.clear();
diff --git a/cc/scheduler/draw_result.h b/cc/scheduler/draw_result.h
new file mode 100644
index 0000000..e63303c
--- /dev/null
+++ b/cc/scheduler/draw_result.h
@@ -0,0 +1,22 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_SCHEDULER_DRAW_RESULT_H_
+#define CC_SCHEDULER_DRAW_RESULT_H_
+
+namespace cc {
+
+enum DrawResult {
+ INVALID_RESULT,
+ DRAW_SUCCESS,
+ DRAW_ABORTED_CHECKERBOARD_ANIMATIONS,
+ DRAW_ABORTED_MISSING_HIGH_RES_CONTENT,
+ DRAW_ABORTED_CANT_READBACK,
+ DRAW_ABORTED_CONTEXT_LOST,
+ DRAW_ABORTED_CANT_DRAW,
+};
+
+} // namespace cc
+
+#endif // CC_SCHEDULER_DRAW_RESULT_H_
diff --git a/cc/scheduler/draw_swap_readback_result.h b/cc/scheduler/draw_swap_readback_result.h
deleted file mode 100644
index 852b897..0000000
--- a/cc/scheduler/draw_swap_readback_result.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_SCHEDULER_DRAW_SWAP_READBACK_RESULT_H_
-#define CC_SCHEDULER_DRAW_SWAP_READBACK_RESULT_H_
-
-namespace cc {
-
-struct DrawSwapReadbackResult {
- enum DrawResult {
- INVALID_RESULT,
- DRAW_SUCCESS,
- DRAW_ABORTED_CHECKERBOARD_ANIMATIONS,
- DRAW_ABORTED_MISSING_HIGH_RES_CONTENT,
- DRAW_ABORTED_CANT_READBACK,
- DRAW_ABORTED_CONTEXT_LOST,
- DRAW_ABORTED_CANT_DRAW,
- };
-
- DrawSwapReadbackResult()
- : draw_result(INVALID_RESULT),
- did_request_swap(false),
- did_readback(false) {}
- DrawSwapReadbackResult(DrawResult draw_result,
- bool did_request_swap,
- bool did_readback)
- : draw_result(draw_result),
- did_request_swap(did_request_swap),
- did_readback(did_readback) {}
- DrawResult draw_result;
- bool did_request_swap;
- bool did_readback;
-};
-
-} // namespace cc
-
-#endif // CC_SCHEDULER_DRAW_SWAP_READBACK_RESULT_H_
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 9345561..7dea302 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -195,6 +195,10 @@ void Scheduler::SetMaxSwapsPending(int max) {
void Scheduler::DidSwapBuffers() {
state_machine_.DidSwapBuffers();
+
+ // Swap should not occur inside readback operation.
+ DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_DRAW_AND_READBACK));
+
// There is no need to call ProcessScheduledActions here because
// swapping should not trigger any new actions.
if (!inside_process_scheduled_actions_) {
@@ -604,18 +608,8 @@ bool Scheduler::IsBeginMainFrameSent() const {
}
void Scheduler::DrawAndSwapIfPossible() {
- DrawSwapReadbackResult result =
- client_->ScheduledActionDrawAndSwapIfPossible();
- state_machine_.DidDrawIfPossibleCompleted(result.draw_result);
-}
-
-void Scheduler::DrawAndSwapForced() {
- client_->ScheduledActionDrawAndSwapForced();
-}
-
-void Scheduler::DrawAndReadback() {
- DrawSwapReadbackResult result = client_->ScheduledActionDrawAndReadback();
- DCHECK(!result.did_request_swap);
+ DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible();
+ state_machine_.DidDrawIfPossibleCompleted(result);
}
void Scheduler::ProcessScheduledActions() {
@@ -659,14 +653,14 @@ void Scheduler::ProcessScheduledActions() {
DrawAndSwapIfPossible();
break;
case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED:
- DrawAndSwapForced();
+ client_->ScheduledActionDrawAndSwapForced();
break;
case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT:
// No action is actually performed, but this allows the state machine to
// advance out of its waiting to draw state without actually drawing.
break;
case SchedulerStateMachine::ACTION_DRAW_AND_READBACK:
- DrawAndReadback();
+ client_->ScheduledActionDrawAndReadback();
break;
case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
client_->ScheduledActionBeginOutputSurfaceCreation();
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index b30f06e..5bf83fc 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -14,7 +14,7 @@
#include "base/time/time.h"
#include "cc/base/cc_export.h"
#include "cc/output/begin_frame_args.h"
-#include "cc/scheduler/draw_swap_readback_result.h"
+#include "cc/scheduler/draw_result.h"
#include "cc/scheduler/scheduler_settings.h"
#include "cc/scheduler/scheduler_state_machine.h"
#include "cc/scheduler/time_source.h"
@@ -30,9 +30,9 @@ class SchedulerClient {
virtual void SetNeedsBeginFrame(bool enable) = 0;
virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0;
virtual void ScheduledActionSendBeginMainFrame() = 0;
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() = 0;
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() = 0;
- virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() = 0;
+ virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0;
+ virtual DrawResult ScheduledActionDrawAndSwapForced() = 0;
+ virtual DrawResult ScheduledActionDrawAndReadback() = 0;
virtual void ScheduledActionAnimate() = 0;
virtual void ScheduledActionCommit() = 0;
virtual void ScheduledActionUpdateVisibleTiles() = 0;
@@ -166,8 +166,6 @@ class CC_EXPORT Scheduler {
void SetupPollingMechanisms(bool needs_begin_frame);
void ActivatePendingTree();
void DrawAndSwapIfPossible();
- void DrawAndSwapForced();
- void DrawAndReadback();
void ProcessScheduledActions();
bool CanCommitAndActivateBeforeDeadline() const;
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 3ed18f6..84a6185 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -24,6 +24,7 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
current_frame_number_(0),
last_frame_number_animate_performed_(-1),
last_frame_number_swap_performed_(-1),
+ last_frame_number_swap_requested_(-1),
last_frame_number_begin_main_frame_sent_(-1),
last_frame_number_update_visible_tiles_was_called_(-1),
manage_tiles_funnel_(0),
@@ -224,6 +225,8 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const {
last_frame_number_animate_performed_);
minor_state->SetInteger("last_frame_number_swap_performed",
last_frame_number_swap_performed_);
+ minor_state->SetInteger("last_frame_number_swap_requested",
+ last_frame_number_swap_requested_);
minor_state->SetInteger(
"last_frame_number_begin_main_frame_sent",
last_frame_number_begin_main_frame_sent_);
@@ -292,6 +295,10 @@ bool SchedulerStateMachine::HasSwappedThisFrame() const {
return current_frame_number_ == last_frame_number_swap_performed_;
}
+bool SchedulerStateMachine::HasRequestedSwapThisFrame() const {
+ return current_frame_number_ == last_frame_number_swap_requested_;
+}
+
bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const {
// These are all the cases where we normally cannot or do not want to draw
// but, if needs_redraw_ is true and we do not draw to make forward progress,
@@ -370,8 +377,8 @@ bool SchedulerStateMachine::ShouldDraw() const {
if (PendingDrawsShouldBeAborted())
return active_tree_needs_first_draw_;
- // After this line, we only want to swap once per frame.
- if (HasSwappedThisFrame())
+ // After this line, we only want to send a swap request once per frame.
+ if (HasRequestedSwapThisFrame())
return false;
// Do not queue too many swaps.
@@ -793,7 +800,7 @@ void SchedulerStateMachine::UpdateStateOnDraw(bool did_request_swap) {
active_tree_needs_first_draw_ = false;
if (did_request_swap)
- last_frame_number_swap_performed_ = current_frame_number_;
+ last_frame_number_swap_requested_ = current_frame_number_;
}
void SchedulerStateMachine::UpdateStateOnManageTiles() {
@@ -901,12 +908,12 @@ bool SchedulerStateMachine::ProactiveBeginFrameWanted() const {
if (needs_manage_tiles_)
return true;
- // If we just swapped, it's likely that we are going to produce another
- // frame soon. This helps avoid negative glitches in our
+ // If we just sent a swap request, it's likely that we are going to produce
+ // another frame soon. This helps avoid negative glitches in our
// SetNeedsBeginFrame requests, which may propagate to the BeginImplFrame
// provider and get sampled at an inopportune time, delaying the next
// BeginImplFrame.
- if (last_frame_number_swap_performed_ == current_frame_number_)
+ if (HasRequestedSwapThisFrame())
return true;
return false;
@@ -987,7 +994,7 @@ bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const {
// If we just sent a BeginMainFrame and haven't hit the deadline yet, the main
// thread is in a low latency mode.
- if (last_frame_number_begin_main_frame_sent_ == current_frame_number_ &&
+ if (HasSentBeginMainFrameThisFrame() &&
(begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING ||
begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME))
return false;
@@ -995,9 +1002,7 @@ bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const {
// If there's a commit in progress it must either be from the previous frame
// or it started after the impl thread's deadline. In either case the main
// thread is in high latency mode.
- if (commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
- commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED ||
- commit_state_ == COMMIT_STATE_READY_TO_COMMIT)
+ if (CommitPending())
return true;
// Similarly, if there's a pending tree the main thread is in high latency
@@ -1011,11 +1016,10 @@ bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const {
if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) {
// Even if there's a new active tree to draw at the deadline or we've just
- // drawn it, it may have been triggered by a previous BeginImplFrame, in
+ // swapped it, it may have been triggered by a previous BeginImplFrame, in
// which case the main thread is in a high latency mode.
- return (active_tree_needs_first_draw_ ||
- last_frame_number_swap_performed_ == current_frame_number_) &&
- last_frame_number_begin_main_frame_sent_ != current_frame_number_;
+ return (active_tree_needs_first_draw_ || HasSwappedThisFrame()) &&
+ !HasSentBeginMainFrameThisFrame();
}
// If the active tree needs its first draw in any other state, we know the
@@ -1057,6 +1061,8 @@ void SchedulerStateMachine::SetMaxSwapsPending(int max) {
void SchedulerStateMachine::DidSwapBuffers() {
pending_swaps_++;
DCHECK_LE(pending_swaps_, max_pending_swaps_);
+
+ last_frame_number_swap_performed_ = current_frame_number_;
}
void SchedulerStateMachine::SetSwapUsedIncompleteTile(
@@ -1074,23 +1080,22 @@ void SchedulerStateMachine::SetSmoothnessTakesPriority(
smoothness_takes_priority_ = smoothness_takes_priority;
}
-void SchedulerStateMachine::DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DrawResult result) {
+void SchedulerStateMachine::DidDrawIfPossibleCompleted(DrawResult result) {
switch (result) {
- case DrawSwapReadbackResult::INVALID_RESULT:
- NOTREACHED() << "Uninitialized DrawSwapReadbackResult.";
+ case INVALID_RESULT:
+ NOTREACHED() << "Uninitialized DrawResult.";
break;
- case DrawSwapReadbackResult::DRAW_ABORTED_CANT_DRAW:
- case DrawSwapReadbackResult::DRAW_ABORTED_CANT_READBACK:
- case DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST:
+ case DRAW_ABORTED_CANT_DRAW:
+ case DRAW_ABORTED_CANT_READBACK:
+ case DRAW_ABORTED_CONTEXT_LOST:
NOTREACHED() << "Invalid return value from DrawAndSwapIfPossible:"
<< result;
break;
- case DrawSwapReadbackResult::DRAW_SUCCESS:
+ case DRAW_SUCCESS:
consecutive_checkerboard_animations_ = 0;
forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE;
break;
- case DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS:
+ case DRAW_ABORTED_CHECKERBOARD_ANIMATIONS:
needs_redraw_ = true;
// If we're already in the middle of a redraw, we don't need to
@@ -1109,7 +1114,7 @@ void SchedulerStateMachine::DidDrawIfPossibleCompleted(
forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT;
}
break;
- case DrawSwapReadbackResult::DRAW_ABORTED_MISSING_HIGH_RES_CONTENT:
+ case DRAW_ABORTED_MISSING_HIGH_RES_CONTENT:
// It's not clear whether this missing content is because of missing
// pictures (which requires a commit) or because of memory pressure
// removing textures (which might not). To be safe, request a commit
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index ff032b6..9df9c08 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -12,7 +12,7 @@
#include "base/time/time.h"
#include "cc/base/cc_export.h"
#include "cc/output/begin_frame_args.h"
-#include "cc/scheduler/draw_swap_readback_result.h"
+#include "cc/scheduler/draw_result.h"
#include "cc/scheduler/scheduler_settings.h"
namespace base {
@@ -193,7 +193,7 @@ class CC_EXPORT SchedulerStateMachine {
bool smoothness_takes_priority() const { return smoothness_takes_priority_; }
// Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen.
- void DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DrawResult result);
+ void DidDrawIfPossibleCompleted(DrawResult result);
// Indicates that a new commit flow needs to be performed, either to pull
// updates from the main thread to the impl, or to push deltas from the impl
@@ -271,6 +271,7 @@ class CC_EXPORT SchedulerStateMachine {
void AdvanceCurrentFrameNumber();
bool HasSentBeginMainFrameThisFrame() const;
bool HasUpdatedVisibleTilesThisFrame() const;
+ bool HasRequestedSwapThisFrame() const;
bool HasSwappedThisFrame() const;
void UpdateStateOnCommit(bool commit_was_aborted);
@@ -292,6 +293,7 @@ class CC_EXPORT SchedulerStateMachine {
int current_frame_number_;
int last_frame_number_animate_performed_;
int last_frame_number_swap_performed_;
+ int last_frame_number_swap_requested_;
int last_frame_number_begin_main_frame_sent_;
int last_frame_number_update_visible_tiles_was_called_;
diff --git a/cc/scheduler/scheduler_state_machine_unittest.cc b/cc/scheduler/scheduler_state_machine_unittest.cc
index 64d1c25..b39d50d 100644
--- a/cc/scheduler/scheduler_state_machine_unittest.cc
+++ b/cc/scheduler/scheduler_state_machine_unittest.cc
@@ -255,6 +255,8 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeDrawDisabled) {
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
@@ -327,6 +329,8 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) {
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
@@ -352,14 +356,15 @@ TEST(SchedulerStateMachineTest,
// We're drawing now.
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_FALSE(state.RedrawPending());
EXPECT_FALSE(state.CommitPending());
// Failing the draw makes us require a commit.
- state.DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
+ state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(
@@ -386,13 +391,14 @@ TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) {
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_FALSE(state.RedrawPending());
EXPECT_FALSE(state.CommitPending());
// Missing high res content requires a commit (but not a redraw)
- state.DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DRAW_ABORTED_MISSING_HIGH_RES_CONTENT);
+ state.DidDrawIfPossibleCompleted(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT);
state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
@@ -421,6 +427,8 @@ TEST(SchedulerStateMachineTest,
// We're drawing now.
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_FALSE(state.RedrawPending());
EXPECT_FALSE(state.CommitPending());
@@ -431,8 +439,7 @@ TEST(SchedulerStateMachineTest,
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// Failing the draw for animation checkerboards makes us require a commit.
- state.DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
+ state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(
@@ -470,8 +477,7 @@ void TestFailedDrawsEventuallyForceDrawAfterNextCommit(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
// Fail the draw.
- state.DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
+ state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_TRUE(state.BeginFrameNeeded());
EXPECT_TRUE(state.RedrawPending());
@@ -497,6 +503,8 @@ void TestFailedDrawsEventuallyForceDrawAfterNextCommit(
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
}
TEST(SchedulerStateMachineTest,
@@ -544,10 +552,8 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) {
// Fail the draw enough times to force a redraw,
// then once more for good measure.
- for (int i = 0; i < draw_limit + 1; ++i) {
- state.DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
- }
+ for (int i = 0; i < draw_limit + 1; ++i)
+ state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_TRUE(state.BeginFrameNeeded());
EXPECT_TRUE(state.RedrawPending());
@@ -569,10 +575,8 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) {
// After failing additional draws, we should still be in a forced
// redraw, but not back in WAITING_FOR_COMMIT.
- for (int i = 0; i < draw_limit + 1; ++i) {
- state.DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
- }
+ for (int i = 0; i < draw_limit + 1; ++i)
+ state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
EXPECT_TRUE(state.RedrawPending());
EXPECT_TRUE(state.ForcedRedrawState() ==
SchedulerStateMachine::FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION);
@@ -599,8 +603,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) {
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
// Failing the draw for animation checkerboards makes us require a commit.
- state.DidDrawIfPossibleCompleted(
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
+ state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
@@ -617,6 +620,8 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) {
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
}
@@ -639,7 +644,9 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) {
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// Before the next BeginImplFrame, set needs redraw again.
@@ -657,7 +664,9 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) {
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// We just swapped, so we should proactively request another BeginImplFrame.
@@ -904,7 +913,9 @@ void TestSetNeedsCommitIsNotLost(bool main_frame_before_draw_enabled) {
EXPECT_TRUE(state.active_tree_needs_first_draw());
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
if (!main_frame_before_draw_enabled) {
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
@@ -962,7 +973,9 @@ TEST(SchedulerStateMachineTest, TestFullCycle) {
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
// Should be synchronized, no draw needed, no action needed.
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
@@ -1014,7 +1027,9 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) {
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
// Should be synchronized, no draw needed, no action needed.
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
@@ -1125,6 +1140,8 @@ TEST(SchedulerStateMachineTest, AbortBeginMainFrameAndCancelCommit) {
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
// Verify another commit doesn't start on another frame either.
EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.CommitState());
@@ -1281,6 +1298,8 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) {
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// Cause a lost context while the BeginMainFrame is in flight.
@@ -1346,6 +1365,8 @@ TEST(SchedulerStateMachineTest,
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// Cause a lost context while the BeginMainFrame is in flight.
@@ -1404,6 +1425,8 @@ TEST(SchedulerStateMachineTest,
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
}
@@ -1676,6 +1699,8 @@ void TestForceCommitWhenReplacementActivationInProgress(
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
if (!settings.main_frame_before_draw_enabled) {
// New replacement commit is scheduled.
EXPECT_ACTION_UPDATE_STATE(
@@ -1715,6 +1740,8 @@ void TestForceCommitWhenReplacementActivationInProgress(
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_EQ(SchedulerStateMachine::READBACK_STATE_IDLE, state.readback_state());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
}
@@ -1787,6 +1814,8 @@ TEST(SchedulerStateMachineTest,
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
+ state.DidSwapBuffers();
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_NONE);
@@ -1856,7 +1885,9 @@ TEST(SchedulerStateMachineTest, TestImmediateFinishCommit) {
EXPECT_TRUE(state.active_tree_needs_first_draw());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
@@ -1892,7 +1923,9 @@ TEST(SchedulerStateMachineTest, TestImmediateFinishCommitDuringCommit) {
EXPECT_TRUE(state.active_tree_needs_first_draw());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// Should be waiting for the normal BeginMainFrame.
@@ -1926,7 +1959,9 @@ TEST(SchedulerStateMachineTest, ImmediateBeginMainFrameAbortedWhileInvisible) {
EXPECT_TRUE(state.active_tree_needs_first_draw());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// Should be waiting for BeginMainFrame.
@@ -1967,7 +2002,9 @@ TEST(SchedulerStateMachineTest, ImmediateFinishCommitWhileCantDraw) {
EXPECT_TRUE(state.active_tree_needs_first_draw());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_READBACK);
- state.DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DRAW_SUCCESS);
+ state.DidSwapBuffers();
+ state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
+ state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
}
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index d307f96..c3d9f38 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -114,16 +114,12 @@ class FakeSchedulerClient : public SchedulerClient {
actions_.push_back("ScheduledActionAnimate");
states_.push_back(scheduler_->AsValue().release());
}
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible()
- OVERRIDE {
+ virtual DrawResult ScheduledActionDrawAndSwapIfPossible() OVERRIDE {
actions_.push_back("ScheduledActionDrawAndSwapIfPossible");
states_.push_back(scheduler_->AsValue().release());
num_draws_++;
- bool did_readback = false;
- DrawSwapReadbackResult::DrawResult result =
- draw_will_happen_
- ? DrawSwapReadbackResult::DRAW_SUCCESS
- : DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ DrawResult result =
+ draw_will_happen_ ? DRAW_SUCCESS : DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
bool swap_will_happen =
draw_will_happen_ && swap_will_happen_if_draw_happens_;
if (swap_will_happen) {
@@ -131,26 +127,17 @@ class FakeSchedulerClient : public SchedulerClient {
if (automatic_swap_ack_)
scheduler_->DidSwapBuffersComplete();
}
- return DrawSwapReadbackResult(
- result,
- draw_will_happen_ && swap_will_happen_if_draw_happens_,
- did_readback);
+ return result;
}
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() OVERRIDE {
+ virtual DrawResult ScheduledActionDrawAndSwapForced() OVERRIDE {
actions_.push_back("ScheduledActionDrawAndSwapForced");
states_.push_back(scheduler_->AsValue().release());
- bool did_request_swap = swap_will_happen_if_draw_happens_;
- bool did_readback = false;
- return DrawSwapReadbackResult(
- DrawSwapReadbackResult::DRAW_SUCCESS, did_request_swap, did_readback);
+ return DRAW_SUCCESS;
}
- virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() OVERRIDE {
+ virtual DrawResult ScheduledActionDrawAndReadback() OVERRIDE {
actions_.push_back("ScheduledActionDrawAndReadback");
states_.push_back(scheduler_->AsValue().release());
- bool did_request_swap = false;
- bool did_readback = true;
- return DrawSwapReadbackResult(
- DrawSwapReadbackResult::DRAW_SUCCESS, did_request_swap, did_readback);
+ return DRAW_SUCCESS;
}
virtual void ScheduledActionCommit() OVERRIDE {
actions_.push_back("ScheduledActionCommit");
@@ -395,7 +382,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
public:
virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {}
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible()
+ virtual DrawResult ScheduledActionDrawAndSwapIfPossible()
OVERRIDE {
// Only SetNeedsRedraw the first time this is called
if (!num_draws_)
@@ -403,12 +390,9 @@ class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
}
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() OVERRIDE {
+ virtual DrawResult ScheduledActionDrawAndSwapForced() OVERRIDE {
NOTREACHED();
- bool did_request_swap = true;
- bool did_readback = false;
- return DrawSwapReadbackResult(
- DrawSwapReadbackResult::DRAW_SUCCESS, did_request_swap, did_readback);
+ return DRAW_SUCCESS;
}
virtual void ScheduledActionCommit() OVERRIDE {}
@@ -509,7 +493,7 @@ class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
: set_needs_commit_on_next_draw_(false) {}
virtual void ScheduledActionSendBeginMainFrame() OVERRIDE {}
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible()
+ virtual DrawResult ScheduledActionDrawAndSwapIfPossible()
OVERRIDE {
// Only SetNeedsCommit the first time this is called
if (set_needs_commit_on_next_draw_) {
@@ -519,12 +503,9 @@ class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
}
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() OVERRIDE {
+ virtual DrawResult ScheduledActionDrawAndSwapForced() OVERRIDE {
NOTREACHED();
- bool did_request_swap = false;
- bool did_readback = false;
- return DrawSwapReadbackResult(
- DrawSwapReadbackResult::DRAW_SUCCESS, did_request_swap, did_readback);
+ return DRAW_SUCCESS;
}
virtual void ScheduledActionCommit() OVERRIDE {}
@@ -713,7 +694,7 @@ TEST(SchedulerTest, BackToBackReadbackAllowed) {
class SchedulerClientNeedsManageTilesInDraw : public FakeSchedulerClient {
public:
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible()
+ virtual DrawResult ScheduledActionDrawAndSwapIfPossible()
OVERRIDE {
scheduler_->SetNeedsManageTiles();
return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 60e8035..2a0762d 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -35,10 +35,10 @@ TestHooks::TestHooks() {}
TestHooks::~TestHooks() {}
-DrawSwapReadbackResult::DrawResult TestHooks::PrepareToDrawOnThread(
+DrawResult TestHooks::PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) {
+ DrawResult draw_result) {
return draw_result;
}
@@ -108,10 +108,9 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
}
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDraw(
- FrameData* frame,
- const gfx::Rect& damage_rect) OVERRIDE {
- DrawSwapReadbackResult::DrawResult draw_result =
+ virtual DrawResult PrepareToDraw(FrameData* frame,
+ const gfx::Rect& damage_rect) OVERRIDE {
+ DrawResult draw_result =
LayerTreeHostImpl::PrepareToDraw(frame, damage_rect);
return test_hooks_->PrepareToDrawOnThread(this, frame, draw_result);
}
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index a4a32d2..e7d618b 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -44,10 +44,10 @@ class TestHooks : public AnimationDelegate {
virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {}
virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
bool success) {}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result);
+ DrawResult draw_result);
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) {}
virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) {}
virtual void SwapBuffersCompleteOnThread(LayerTreeHostImpl* host_impl) {}
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 171880e..3683884 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -698,7 +698,7 @@ static void AppendQuadsToFillScreen(
}
}
-DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::CalculateRenderPasses(
+DrawResult LayerTreeHostImpl::CalculateRenderPasses(
FrameData* frame) {
DCHECK(frame->render_passes.empty());
DCHECK(CanDraw());
@@ -727,7 +727,7 @@ DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::CalculateRenderPasses(
frame->has_no_damage = true;
DCHECK(!output_surface_->capabilities()
.draw_and_swap_full_viewport_every_frame);
- return DrawSwapReadbackResult::DRAW_SUCCESS;
+ return DRAW_SUCCESS;
}
TRACE_EVENT1("cc",
@@ -784,8 +784,7 @@ DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::CalculateRenderPasses(
// still draw the frame. However when the layer being checkerboarded is moving
// due to an impl-animation, we drop the frame to avoid flashing due to the
// texture suddenly appearing in the future.
- DrawSwapReadbackResult::DrawResult draw_result =
- DrawSwapReadbackResult::DRAW_SUCCESS;
+ DrawResult draw_result = DRAW_SUCCESS;
// When we have a copy request for a layer, we need to draw no matter
// what, as the layer may disappear after this frame.
bool have_copy_request = false;
@@ -873,17 +872,14 @@ DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::CalculateRenderPasses(
bool layer_has_animating_transform =
it->screen_space_transform_is_animating() ||
it->draw_transform_is_animating();
- if (layer_has_animating_transform) {
- draw_result =
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
- }
+ if (layer_has_animating_transform)
+ draw_result = DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
if (append_quads_data.had_incomplete_tile) {
frame->contains_incomplete_tile = true;
if (active_tree()->RequiresHighResToDraw())
- draw_result =
- DrawSwapReadbackResult::DRAW_ABORTED_MISSING_HIGH_RES_CONTENT;
+ draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT;
}
occlusion_tracker.LeaveLayer(it);
@@ -891,7 +887,7 @@ DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::CalculateRenderPasses(
if (have_copy_request ||
output_surface_->capabilities().draw_and_swap_full_viewport_every_frame)
- draw_result = DrawSwapReadbackResult::DRAW_SUCCESS;
+ draw_result = DRAW_SUCCESS;
#if DCHECK_IS_ON
for (size_t i = 0; i < frame->render_passes.size(); ++i) {
@@ -1086,9 +1082,8 @@ void LayerTreeHostImpl::RemoveRenderPasses(RenderPassCuller culler,
}
}
-DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::PrepareToDraw(
- FrameData* frame,
- const gfx::Rect& damage_rect) {
+DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame,
+ const gfx::Rect& damage_rect) {
TRACE_EVENT1("cc",
"LayerTreeHostImpl::PrepareToDraw",
"SourceFrameNumber",
@@ -1118,8 +1113,8 @@ DrawSwapReadbackResult::DrawResult LayerTreeHostImpl::PrepareToDraw(
AddDamageNextUpdate(device_viewport_damage_rect);
}
- DrawSwapReadbackResult::DrawResult draw_result = CalculateRenderPasses(frame);
- if (draw_result != DrawSwapReadbackResult::DRAW_SUCCESS) {
+ DrawResult draw_result = CalculateRenderPasses(frame);
+ if (draw_result != DRAW_SUCCESS) {
DCHECK(!output_surface_->capabilities()
.draw_and_swap_full_viewport_every_frame);
return draw_result;
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 796f603..b9070ac 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -31,7 +31,7 @@
#include "cc/quads/render_pass.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/tile_manager.h"
-#include "cc/scheduler/draw_swap_readback_result.h"
+#include "cc/scheduler/draw_result.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/rect.h"
@@ -192,9 +192,8 @@ class CC_EXPORT LayerTreeHostImpl
// to avoid displaying the frame. If PrepareToDraw is called, DidDrawAllLayers
// must also be called, regardless of whether DrawLayers is called between the
// two.
- virtual DrawSwapReadbackResult::DrawResult PrepareToDraw(
- FrameData* frame,
- const gfx::Rect& damage_rect);
+ virtual DrawResult PrepareToDraw(FrameData* frame,
+ const gfx::Rect& damage_rect);
virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time);
// Must be called if and only if PrepareToDraw was called.
void DidDrawAllLayers(const FrameData& frame);
@@ -380,7 +379,7 @@ class CC_EXPORT LayerTreeHostImpl
const LayerTreeDebugState& debug_state() const { return debug_state_; }
class CC_EXPORT CullRenderPassesWithNoQuads {
- public:
+ public:
bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
const FrameData& frame) const;
@@ -514,7 +513,7 @@ class CC_EXPORT LayerTreeHostImpl
// This function should only be called from PrepareToDraw, as DidDrawAllLayers
// must be called if this helper function is called. Returns DRAW_SUCCESS if
// the frame should be drawn.
- DrawSwapReadbackResult::DrawResult CalculateRenderPasses(FrameData* frame);
+ DrawResult CalculateRenderPasses(FrameData* frame);
bool EnsureRenderSurfaceLayerList();
void ClearCurrentlyScrollingLayer();
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 3181410..c262802 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -302,8 +302,7 @@ class LayerTreeHostImplTest : public testing::Test,
void DrawFrame() {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -1727,7 +1726,7 @@ TEST_F(LayerTreeHostImplTest, WillDrawReturningFalseDoesNotCall) {
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
+ EXPECT_EQ(DRAW_SUCCESS,
host_impl_->PrepareToDraw(&frame, gfx::Rect(10, 10)));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -1743,7 +1742,7 @@ TEST_F(LayerTreeHostImplTest, WillDrawReturningFalseDoesNotCall) {
layer->set_will_draw_returns_false();
layer->ClearDidDrawCheck();
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
+ EXPECT_EQ(DRAW_SUCCESS,
host_impl_->PrepareToDraw(&frame, gfx::Rect(10, 10)));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -1776,8 +1775,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) {
EXPECT_FALSE(layer->will_draw_called());
EXPECT_FALSE(layer->did_draw_called());
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -1792,8 +1790,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) {
EXPECT_FALSE(layer->will_draw_called());
EXPECT_FALSE(layer->did_draw_called());
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -1832,8 +1829,7 @@ TEST_F(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) {
EXPECT_FALSE(top_layer->will_draw_called());
EXPECT_FALSE(top_layer->did_draw_called());
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -1865,8 +1861,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) {
EXPECT_FALSE(layer2->did_draw_called());
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -1951,8 +1946,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenNoTexturesMissing) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -1975,8 +1969,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -2001,8 +1994,7 @@ TEST_F(LayerTreeHostImplTest,
is_animating,
host_impl_->resource_provider()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -2025,7 +2017,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawFailsWhenAnimationUsesCheckerboard) {
is_animating,
host_impl_->resource_provider()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS,
+ EXPECT_EQ(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS,
host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -2049,8 +2041,7 @@ TEST_F(LayerTreeHostImplTest,
is_animating,
host_impl_->resource_provider()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(host_impl_->PrepareToDraw(&frame, gfx::Rect()),
- DrawSwapReadbackResult::DRAW_SUCCESS);
+ EXPECT_EQ(host_impl_->PrepareToDraw(&frame, gfx::Rect()), DRAW_SUCCESS);
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -2074,8 +2065,7 @@ TEST_F(LayerTreeHostImplTest,
host_impl_->resource_provider()));
host_impl_->active_tree()->SetRequiresHighResToDraw();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(host_impl_->PrepareToDraw(&frame, gfx::Rect()),
- DrawSwapReadbackResult::DRAW_SUCCESS);
+ EXPECT_EQ(host_impl_->PrepareToDraw(&frame, gfx::Rect()), DRAW_SUCCESS);
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -2100,7 +2090,7 @@ TEST_F(LayerTreeHostImplTest,
host_impl_->active_tree()->SetRequiresHighResToDraw();
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(host_impl_->PrepareToDraw(&frame, gfx::Rect()),
- DrawSwapReadbackResult::DRAW_ABORTED_MISSING_HIGH_RES_CONTENT);
+ DRAW_ABORTED_MISSING_HIGH_RES_CONTENT);
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -2552,8 +2542,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) {
// Make sure all the layers are drawn with the page scale delta applied, i.e.,
// the page scale delta on the root layer is applied hierarchically.
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -3542,8 +3531,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(true);
layer1->SetExpectation(false, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3552,8 +3540,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetContentsOpaque(false);
layer1->SetExpectation(true, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3563,8 +3550,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetOpacity(0.5f);
layer1->SetExpectation(true, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3574,8 +3560,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetOpacity(0.5f);
layer1->SetExpectation(true, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3597,8 +3582,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer2->SetOpacity(1.f);
layer2->SetExpectation(false, false);
layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
@@ -3611,8 +3595,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
layer2->SetExpectation(false, false);
layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
@@ -3626,8 +3609,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
layer2->SetExpectation(false, false);
layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
@@ -3644,8 +3626,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
layer2->SetExpectation(false, false);
layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
@@ -3661,8 +3642,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer2->SetOpacity(0.5f);
layer2->SetExpectation(true, false);
layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
@@ -3677,8 +3657,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer2->SetOpacity(1.f);
layer2->SetExpectation(true, false);
layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
@@ -3694,8 +3673,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer2->SetOpacity(1.f);
layer2->SetExpectation(false, false);
layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
@@ -3708,8 +3686,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(true, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3721,8 +3698,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(true, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3734,8 +3710,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(true, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3748,8 +3723,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->SetExpectation(false, false);
layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds()));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(layer1->quads_appended());
host_impl_->DidDrawAllLayers(frame);
@@ -3794,8 +3768,7 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list));
@@ -3816,8 +3789,7 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
EXPECT_EQ(1u, CountGutterQuads(frame.render_passes[0]->quad_list));
@@ -3838,8 +3810,7 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
EXPECT_EQ(4u, CountGutterQuads(frame.render_passes[0]->quad_list));
@@ -3861,8 +3832,7 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list));
@@ -4077,8 +4047,7 @@ TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) {
LayerTreeHostImpl::FrameData frame;
host_impl_->SetViewportSize(gfx::Size(10, 10));
host_impl_->SetDeviceScaleFactor(1.f);
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(provider->TestContext3d()->reshape_called());
EXPECT_EQ(provider->TestContext3d()->width(), 10);
@@ -4088,8 +4057,7 @@ TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) {
provider->TestContext3d()->clear_reshape_called();
host_impl_->SetViewportSize(gfx::Size(20, 30));
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(provider->TestContext3d()->reshape_called());
EXPECT_EQ(provider->TestContext3d()->width(), 20);
@@ -4099,8 +4067,7 @@ TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) {
provider->TestContext3d()->clear_reshape_called();
host_impl_->SetDeviceScaleFactor(2.f);
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
EXPECT_TRUE(provider->TestContext3d()->reshape_called());
EXPECT_EQ(provider->TestContext3d()->width(), 20);
@@ -4156,7 +4123,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
LayerTreeHostImpl::FrameData frame;
// First frame, the entire screen should get swapped.
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
+ EXPECT_EQ(DRAW_SUCCESS,
layer_tree_host_impl->PrepareToDraw(&frame, gfx::Rect()));
layer_tree_host_impl->DrawLayers(&frame, gfx::FrameTime::Now());
layer_tree_host_impl->DidDrawAllLayers(frame);
@@ -4170,7 +4137,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
// expected swap rect: vertically flipped, with origin at bottom left corner.
layer_tree_host_impl->active_tree()->root_layer()->children()[0]->SetPosition(
gfx::PointF());
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
+ EXPECT_EQ(DRAW_SUCCESS,
layer_tree_host_impl->PrepareToDraw(&frame, gfx::Rect()));
layer_tree_host_impl->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -4190,7 +4157,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
// This will damage everything.
layer_tree_host_impl->active_tree()->root_layer()->SetBackgroundColor(
SK_ColorBLACK);
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
+ EXPECT_EQ(DRAW_SUCCESS,
layer_tree_host_impl->PrepareToDraw(&frame, gfx::Rect()));
layer_tree_host_impl->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -4220,8 +4187,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
EXPECT_EQ(1u, frame.render_surface_layer_list->size());
EXPECT_EQ(1u, frame.render_passes.size());
host_impl_->DidDrawAllLayers(frame);
@@ -4358,8 +4324,7 @@ TEST_F(LayerTreeHostImplTest, NoPartialSwap) {
harness.MustSetNoScissor();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -4372,8 +4337,7 @@ TEST_F(LayerTreeHostImplTest, NoPartialSwap) {
harness.MustSetScissor(0, 0, 10, 10);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -4397,8 +4361,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwap) {
harness.MustDrawSolidQuad();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -4413,8 +4376,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwap) {
harness.MustDrawSolidQuad();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
}
@@ -4512,8 +4474,7 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
&stats_instrumentation_);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- my_host_impl->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame, gfx::Rect()));
// Verify all quads have been computed
ASSERT_EQ(2U, frame.render_passes.size());
@@ -4540,8 +4501,7 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) {
&stats_instrumentation_);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- my_host_impl->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame, gfx::Rect()));
// Verify all quads have been computed
ASSERT_EQ(2U, frame.render_passes.size());
@@ -4597,8 +4557,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
EXPECT_EQ(0u, context3d->NumTextures());
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
host_impl_->SwapBuffers(frame);
@@ -4643,8 +4602,7 @@ TEST_F(LayerTreeHostImplTest, HasTransparentBackground) {
EXPECT_CALL(*mock_context, drawElements(_, _, _, _))
.Times(1);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
Mock::VerifyAndClearExpectations(&mock_context);
@@ -4652,8 +4610,7 @@ TEST_F(LayerTreeHostImplTest, HasTransparentBackground) {
// Verify no quads are drawn when transparent background is set.
host_impl_->active_tree()->set_has_transparent_background(true);
host_impl_->SetFullRootLayerDamage();
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
Mock::VerifyAndClearExpectations(&mock_context);
@@ -4710,8 +4667,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer
bool expect_to_draw = !expected_damage.IsEmpty();
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
if (!expect_to_draw) {
// With no damage, we don't draw, and no quads are created.
@@ -4870,8 +4826,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) {
host_impl_->SetDeviceScaleFactor(device_scale_factor);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -4899,8 +4854,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -4930,8 +4884,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -4994,8 +4947,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
host_impl_->SetDeviceScaleFactor(device_scale_factor);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -5022,8 +4974,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -5053,8 +5004,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -5079,8 +5029,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -5148,8 +5097,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
host_impl_->SetDeviceScaleFactor(device_scale_factor);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
@@ -5177,8 +5125,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
@@ -5209,8 +5156,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
@@ -5236,8 +5182,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
host_impl_->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
@@ -5317,8 +5262,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) {
host_impl_->SetDeviceScaleFactor(device_scale_factor);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
@@ -5352,8 +5296,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) {
content_child_layer->SetPosition(gfx::Point(-50, 0));
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(2u, frame.render_passes[0]->quad_list.size());
@@ -5452,8 +5395,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerForSurfaceWithClippedLayer) {
host_impl_->SetDeviceScaleFactor(device_scale_factor);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
@@ -5534,8 +5476,7 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) {
ASSERT_EQ(1u, host_impl_->active_tree()->RenderSurfaceLayerList().size());
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
ASSERT_EQ(1u, frame.render_passes.size());
ASSERT_LE(1u, frame.render_passes[0]->quad_list.size());
@@ -5569,8 +5510,7 @@ TEST_F(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) {
SetupRootLayerImpl(FakeLayerWithQuads::Create(host_impl_->active_tree(), 1));
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, base::TimeTicks());
host_impl_->DidDrawAllLayers(frame);
}
@@ -5650,8 +5590,7 @@ TEST_F(LayerTreeHostImplTest,
SetupRootLayerImpl(root_layer.PassAs<LayerImpl>());
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -5916,8 +5855,7 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) {
host_impl_->active_tree()->root_layer()->PassCopyRequests(&requests);
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
@@ -6192,8 +6130,7 @@ TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
gfx::Rect full_frame_damage(host_impl_->DrawViewportSize());
LayerTreeHostImpl::FrameData frame;
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS,
- host_impl_->PrepareToDraw(&frame, gfx::Rect()));
+ EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame, gfx::Rect()));
host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
host_impl_->DidDrawAllLayers(frame);
EXPECT_TRUE(host_impl_->SwapBuffers(frame));
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index ea490cd..52ac0f6 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -286,11 +286,11 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
gfx::RectF root_damage_rect;
if (!frame_data->render_passes.empty())
@@ -518,10 +518,10 @@ class LayerTreeHostTestCompositeAndReadbackDuringForcedDraw
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
int sfn = host_impl->active_tree()->source_frame_number();
EXPECT_TRUE(sfn == kFirstCommitSourceFrameNumber ||
sfn == kReadbackSourceFrameNumber ||
@@ -536,7 +536,7 @@ class LayerTreeHostTestCompositeAndReadbackDuringForcedDraw
}
// Aborting for checkerboarding animations will result in a forced draw.
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
@@ -579,10 +579,10 @@ class LayerTreeHostTestCompositeAndReadbackAfterForcedDraw
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
int sfn = host_impl->active_tree()->source_frame_number();
EXPECT_TRUE(sfn == kFirstCommitSourceFrameNumber ||
sfn == kForcedDrawSourceFrameNumber ||
@@ -591,7 +591,7 @@ class LayerTreeHostTestCompositeAndReadbackAfterForcedDraw
<< sfn;
// Aborting for checkerboarding animations will result in a forced draw.
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void DidCommit() OVERRIDE {
@@ -656,11 +656,11 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
host_impl->SetNeedsRedrawRect(invalid_rect_);
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
gfx::RectF root_damage_rect;
if (!frame_data->render_passes.empty())
@@ -754,11 +754,11 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
gfx::RectF root_damage_rect;
if (!frame_data->render_passes.empty())
@@ -2619,12 +2619,12 @@ class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
EndTest();
- return DrawSwapReadbackResult::DRAW_SUCCESS;
+ return DRAW_SUCCESS;
}
virtual void AfterTest() OVERRIDE {}
@@ -2924,10 +2924,10 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
EXPECT_CALL(*mock_context_, bindTexture(_, 0)).Times(AnyNumber());
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
Mock::VerifyAndClearExpectations(&mock_context_);
ResourceProvider* resource_provider = host_impl->resource_provider();
EXPECT_EQ(1u, resource_provider->num_resources());
@@ -4198,10 +4198,10 @@ class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
++num_commits_;
switch (num_commits_) {
case 1:
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 70610f7..8e11556 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -200,11 +200,11 @@ class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws
EndTest();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ DrawResult draw_result) OVERRIDE {
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void AfterTest() OVERRIDE { }
@@ -332,13 +332,13 @@ class LayerTreeHostAnimationTestAnimationTickTimeIsMonotonic
}
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
if (TestEnded())
return draw_result;
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void AfterTest() OVERRIDE {}
@@ -1065,10 +1065,10 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
PostSetNeedsCommitToMainThread();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
if (added_animations_ < 2)
return draw_result;
if (TestEnded())
@@ -1077,7 +1077,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
++prevented_draw_;
if (prevented_draw_ > 2)
EndTest();
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void DidCommitAndDrawFrame() OVERRIDE {
@@ -1209,10 +1209,9 @@ class LayerTreeHostAnimationTestFrozenAnimationTickTime
}
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ virtual DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ DrawResult draw_result) OVERRIDE {
if (TestEnded())
return draw_result;
num_draw_attempts_++;
@@ -1220,7 +1219,7 @@ class LayerTreeHostAnimationTestFrozenAnimationTickTime
num_draw_attempts_ = 0;
PostSetNeedsCommitToMainThread();
}
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 334368f..57f901b 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -96,11 +96,11 @@ class LayerTreeHostContextTest : public LayerTreeTest {
return FakeOutputSurface::Create3d(context3d.Pass());
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
if (!times_to_lose_during_draw_)
return draw_result;
@@ -855,10 +855,10 @@ class LayerTreeHostContextTestDontUseLostResources
}
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
if (host_impl->active_tree()->source_frame_number() == 2) {
// Lose the context during draw on the second commit. This will cause
// a third commit to recover.
@@ -949,10 +949,10 @@ class LayerTreeHostContextTestCompositeAndReadbackBeforeOutputSurfaceInit
EXPECT_EQ(1, times_output_surface_created_);
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
EXPECT_GE(host_impl->active_tree()->source_frame_number(), 0);
EXPECT_LE(host_impl->active_tree()->source_frame_number(), 1);
return draw_result;
@@ -1001,10 +1001,10 @@ class LayerTreeHostContextTestLoseOutputSurfaceDuringReadbackAndForcedDraw
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
int sfn = host_impl->active_tree()->source_frame_number();
EXPECT_TRUE(sfn == kFirstOutputSurfaceInitSourceFrameNumber ||
sfn == kSecondOutputSurfaceInitSourceFrameNumber ||
@@ -1021,7 +1021,7 @@ class LayerTreeHostContextTestLoseOutputSurfaceDuringReadbackAndForcedDraw
LoseContext();
}
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
@@ -1080,10 +1080,10 @@ class LayerTreeHostContextTestReadbackWithForcedDrawAndOutputSurfaceInit
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ DrawResult draw_result) OVERRIDE {
int sfn = host_impl->active_tree()->source_frame_number();
EXPECT_TRUE(sfn == kFirstOutputSurfaceInitSourceFrameNumber ||
sfn == kSecondOutputSurfaceInitSourceFrameNumber ||
@@ -1099,7 +1099,7 @@ class LayerTreeHostContextTestReadbackWithForcedDrawAndOutputSurfaceInit
}
// Returning false will result in a forced draw.
- return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
+ return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
}
virtual void DidInitializeOutputSurface() OVERRIDE {
diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc
index eb91e53..33cd7ad 100644
--- a/cc/trees/layer_tree_host_unittest_damage.cc
+++ b/cc/trees/layer_tree_host_unittest_damage.cc
@@ -48,11 +48,11 @@ class LayerTreeHostDamageTestSetNeedsRedraw
}
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
RenderSurfaceImpl* root_surface =
impl->active_tree()->root_layer()->render_surface();
@@ -110,11 +110,11 @@ class LayerTreeHostDamageTestSetViewportSize
}
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
RenderSurfaceImpl* root_surface =
impl->active_tree()->root_layer()->render_surface();
@@ -169,11 +169,11 @@ class LayerTreeHostDamageTestNoDamageDoesNotSwap
LayerTreeHostDamageTest::SetupTree();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
int source_frame = host_impl->active_tree()->source_frame_number();
switch (source_frame) {
@@ -259,11 +259,11 @@ class LayerTreeHostDamageTestNoDamageReadbackDoesDraw
LayerTreeHostDamageTest::SetupTree();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
int source_frame = host_impl->active_tree()->source_frame_number();
switch (source_frame) {
@@ -330,11 +330,11 @@ class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest {
LayerTreeHostDamageTest::SetupTree();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
RenderSurfaceImpl* root_surface =
host_impl->active_tree()->root_layer()->render_surface();
@@ -472,11 +472,11 @@ class LayerTreeHostDamageTestScrollbarDoesDamage
PostSetNeedsCommitToMainThread();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
RenderSurfaceImpl* root_surface =
host_impl->active_tree()->root_layer()->render_surface();
gfx::RectF root_damage =
@@ -546,11 +546,11 @@ class LayerTreeHostDamageTestScrollbarCommitDoesNoDamage
PostSetNeedsCommitToMainThread();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
RenderSurfaceImpl* root_surface =
host_impl->active_tree()->root_layer()->render_surface();
gfx::RectF root_damage =
@@ -638,11 +638,11 @@ class LayerTreeHostDamageTestVisibleTilesStillTriggerDraws
update_visible_tile_count_ = 0;
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame_data,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
prepare_to_draw_count_++;
switch (prepare_to_draw_count_) {
case 1:
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index 02f8db3..7ef3c1f 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -589,11 +589,11 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
first_draw_for_source_frame_ = true;
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
+ virtual DrawResult PrepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ DrawResult draw_result) OVERRIDE {
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
if (!first_draw_for_source_frame_)
return draw_result;
diff --git a/cc/trees/layer_tree_host_unittest_video.cc b/cc/trees/layer_tree_host_unittest_video.cc
index 55defd6..1941018 100644
--- a/cc/trees/layer_tree_host_unittest_video.cc
+++ b/cc/trees/layer_tree_host_unittest_video.cc
@@ -46,10 +46,9 @@ class LayerTreeHostVideoTestSetNeedsDisplay
PostSetNeedsCommitToMainThread();
}
- virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
+ virtual DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ DrawResult draw_result) OVERRIDE {
LayerImpl* root_layer = host_impl->active_tree()->root_layer();
RenderSurfaceImpl* root_surface = root_layer->render_surface();
gfx::RectF damage_rect =
@@ -69,7 +68,7 @@ class LayerTreeHostVideoTestSetNeedsDisplay
break;
}
- EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result);
+ EXPECT_EQ(DRAW_SUCCESS, draw_result);
return draw_result;
}
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 0483234..bacfed6 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -1115,12 +1115,12 @@ void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() {
main_thread_weak_ptr_));
}
-DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
+DrawResult ThreadProxy::DrawSwapReadbackInternal(
bool forced_draw,
bool swap_requested,
bool readback_requested) {
TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap");
- DrawSwapReadbackResult result;
+ DrawResult result;
DCHECK(IsImplThread());
DCHECK(impl().layer_tree_host_impl.get());
@@ -1162,24 +1162,22 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
if (drawing_for_readback)
readback_rect = impl().readback_request->rect;
- result.draw_result =
+ result =
impl().layer_tree_host_impl->PrepareToDraw(&frame, readback_rect);
- draw_frame = forced_draw ||
- result.draw_result == DrawSwapReadbackResult::DRAW_SUCCESS;
+ draw_frame = forced_draw || result == DRAW_SUCCESS;
} else {
- result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_CANT_READBACK;
+ result = DRAW_ABORTED_CANT_READBACK;
}
} else {
- result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_CANT_DRAW;
+ result = DRAW_ABORTED_CANT_DRAW;
}
if (draw_frame) {
impl().layer_tree_host_impl->DrawLayers(
&frame, impl().scheduler->LastBeginImplFrameTime());
- result.draw_result = DrawSwapReadbackResult::DRAW_SUCCESS;
+ result = DRAW_SUCCESS;
impl().animations_frozen_until_next_draw = false;
- } else if (result.draw_result ==
- DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS &&
+ } else if (result == DRAW_ABORTED_CHECKERBOARD_ANIMATIONS &&
!impl().layer_tree_host_impl->settings().impl_side_painting) {
// Without impl-side painting, the animated layer that is checkerboarding
// will continue to checkerboard until the next commit. If this layer
@@ -1190,7 +1188,7 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
// we freeze animations until we successfully draw.
impl().animations_frozen_until_next_draw = true;
} else {
- DCHECK_NE(DrawSwapReadbackResult::DRAW_SUCCESS, result.draw_result);
+ DCHECK_NE(DRAW_SUCCESS, result);
}
impl().layer_tree_host_impl->DidDrawAllLayers(frame);
@@ -1200,25 +1198,25 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
// Check for a pending CompositeAndReadback.
if (drawing_for_readback) {
DCHECK(!swap_requested);
- result.did_readback = false;
+ bool did_readback = false;
if (draw_frame) {
if (!impl().layer_tree_host_impl->IsContextLost()) {
impl().layer_tree_host_impl->Readback(impl().readback_request->pixels,
impl().readback_request->rect);
- result.did_readback = true;
+ did_readback = true;
} else {
- result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST;
+ result = DRAW_ABORTED_CONTEXT_LOST;
}
}
- impl().readback_request->success = result.did_readback;
+ impl().readback_request->success = did_readback;
impl().readback_request->completion.Signal();
impl().readback_request = NULL;
} else if (draw_frame) {
DCHECK(swap_requested);
- result.did_request_swap = impl().layer_tree_host_impl->SwapBuffers(frame);
+ bool did_request_swap = impl().layer_tree_host_impl->SwapBuffers(frame);
// We don't know if we have incomplete tiles if we didn't actually swap.
- if (result.did_request_swap) {
+ if (did_request_swap) {
DCHECK(!frame.has_no_damage);
SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile);
}
@@ -1235,7 +1233,7 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
if (draw_frame)
CheckOutputSurfaceStatusOnImplThread();
- if (result.draw_result == DrawSwapReadbackResult::DRAW_SUCCESS) {
+ if (result == DRAW_SUCCESS) {
base::TimeDelta draw_duration = impl().timing_history.DidFinishDrawing();
base::TimeDelta draw_duration_overestimate;
@@ -1261,7 +1259,7 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
50);
}
- DCHECK_NE(DrawSwapReadbackResult::INVALID_RESULT, result.draw_result);
+ DCHECK_NE(INVALID_RESULT, result);
return result;
}
@@ -1271,7 +1269,7 @@ void ThreadProxy::ScheduledActionManageTiles() {
impl().layer_tree_host_impl->ManageTiles();
}
-DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
+DrawResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap");
// SchedulerStateMachine::DidDrawIfPossibleCompleted isn't set up to
@@ -1286,7 +1284,7 @@ DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
forced_draw, swap_requested, readback_requested);
}
-DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapForced() {
+DrawResult ThreadProxy::ScheduledActionDrawAndSwapForced() {
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwapForced");
bool forced_draw = true;
bool swap_requested = true;
@@ -1295,7 +1293,7 @@ DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndSwapForced() {
forced_draw, swap_requested, readback_requested);
}
-DrawSwapReadbackResult ThreadProxy::ScheduledActionDrawAndReadback() {
+DrawResult ThreadProxy::ScheduledActionDrawAndReadback() {
TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndReadback");
bool forced_draw = true;
bool swap_requested = false;
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index 8df7958..d670444 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -110,10 +110,9 @@ class ThreadProxy : public Proxy,
virtual void SetNeedsBeginFrame(bool enable) OVERRIDE;
virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE;
virtual void ScheduledActionSendBeginMainFrame() OVERRIDE;
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible()
- OVERRIDE;
- virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() OVERRIDE;
- virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() OVERRIDE;
+ virtual DrawResult ScheduledActionDrawAndSwapIfPossible() OVERRIDE;
+ virtual DrawResult ScheduledActionDrawAndSwapForced() OVERRIDE;
+ virtual DrawResult ScheduledActionDrawAndReadback() OVERRIDE;
virtual void ScheduledActionAnimate() OVERRIDE;
virtual void ScheduledActionCommit() OVERRIDE;
virtual void ScheduledActionUpdateVisibleTiles() OVERRIDE;
@@ -182,9 +181,9 @@ class ThreadProxy : public Proxy,
RendererCapabilities* capabilities);
void FinishGLOnImplThread(CompletionEvent* completion);
void LayerTreeHostClosedOnImplThread(CompletionEvent* completion);
- DrawSwapReadbackResult DrawSwapReadbackInternal(bool forced_draw,
- bool swap_requested,
- bool readback_requested);
+ DrawResult DrawSwapReadbackInternal(bool forced_draw,
+ bool swap_requested,
+ bool readback_requested);
void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion);
void CheckOutputSurfaceStatusOnImplThread();
void CommitPendingOnImplThreadForTesting(CommitPendingRequest* request);