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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 286953008: cc: Allow DeferredInitialize to use DelegatingRenderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index d1b518b44c8b1e250437f3be03c9eea062728c81..a768a23d1e60541d29ffbdb52e9bdefe03a6a0ac 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -20,6 +20,7 @@
#include "cc/layers/solid_color_layer.h"
#include "cc/layers/video_layer.h"
#include "cc/output/begin_frame_args.h"
+#include "cc/output/compositor_frame_ack.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
#include "cc/output/output_surface.h"
@@ -2761,8 +2762,12 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
scoped_ptr<TestWebGraphicsContext3D> context3d(
TestWebGraphicsContext3D::Create());
- return FakeOutputSurface::CreateDeferredGL(
- scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice));
+ scoped_ptr<FakeOutputSurface> output_surface =
+ FakeOutputSurface::CreateDeferredGL(
+ scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice),
+ delegating_renderer());
+ output_surface->set_forced_draw_to_software_device(true);
danakj 2014/05/16 22:08:47 Why are these set calls needed/correct?
boliu 2014/05/16 22:15:10 To avoid failing this DCHECK in GetDrawMode: https
danakj 2014/05/16 22:19:29 We should update this DCHECK then, to allow this w
boliu 2014/05/16 22:34:37 Relaxed DCHECK to allow deferred_gl too. It should
+ return output_surface.Pass();
}
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
@@ -2810,6 +2815,7 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
TestContextProvider::Create(); // Not bound to thread.
EXPECT_TRUE(
fake_output_surface->InitializeAndSetContext3d(context_provider));
+ fake_output_surface->set_forced_draw_to_software_device(false);
did_initialize_gl_ = true;
}
@@ -2817,10 +2823,31 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
EXPECT_TRUE(did_initialize_gl_);
EXPECT_FALSE(did_release_gl_);
// ReleaseGL calls SetNeedsCommit.
- static_cast<FakeOutputSurface*>(host_impl->output_surface())->ReleaseGL();
+ FakeOutputSurface* output_surface =
+ static_cast<FakeOutputSurface*>(host_impl->output_surface());
+ output_surface->ReleaseGL();
+ output_surface->set_forced_draw_to_software_device(true);
did_release_gl_ = true;
}
+ virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
+ bool result) OVERRIDE {
+ ASSERT_TRUE(result);
+ DelegatedFrameData* delegated_frame_data =
+ output_surface()->last_sent_frame().delegated_frame_data.get();
+ if (!delegated_frame_data)
+ return;
+
+ // Return all resources immediately.
+ TransferableResourceArray resources_to_return =
+ output_surface()->resources_held_by_parent();
+
+ CompositorFrameAck ack;
+ for (size_t i = 0; i < resources_to_return.size(); ++i)
+ output_surface()->ReturnResource(resources_to_return[i].id, &ack);
+ host_impl->ReclaimResources(&ack);
+ }
+
virtual void AfterTest() OVERRIDE {
EXPECT_TRUE(did_initialize_gl_);
EXPECT_TRUE(did_release_gl_);
@@ -2834,7 +2861,7 @@ class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
int last_source_frame_number_drawn_;
};
-MULTI_THREAD_DIRECT_RENDERER_TEST_F(LayerTreeHostTestDeferredInitialize);
+MULTI_THREAD_TEST_F(LayerTreeHostTestDeferredInitialize);
// Test for UI Resource management.
class LayerTreeHostTestUIResource : public LayerTreeHostTest {
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698