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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in last patch Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 7786bae2e4d734188576fcdb1c144dd8213d5c56..2b2b28faa77354ae61206346ea7ee876ca7fab1e 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -168,7 +168,8 @@ class LayerTreeHostImplTest : public testing::Test,
settings, this, &proxy_, &stats_instrumentation_,
&shared_bitmap_manager_, &gpu_memory_buffer_manager_,
&task_graph_runner_, 0);
- bool init = host_impl_->InitializeRenderer(output_surface.Pass());
+ output_surface_ = output_surface.Pass();
+ bool init = host_impl_->InitializeRenderer(output_surface_.get());
host_impl_->SetViewportSize(gfx::Size(10, 10));
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
// Set the BeginFrameArgs so that methods which use it are able to.
@@ -420,6 +421,7 @@ class LayerTreeHostImplTest : public testing::Test,
TestSharedBitmapManager shared_bitmap_manager_;
TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
TestTaskGraphRunner task_graph_runner_;
+ scoped_ptr<OutputSurface> output_surface_;
scoped_ptr<LayerTreeHostImpl> host_impl_;
FakeRenderingStatsInstrumentation stats_instrumentation_;
bool on_can_draw_state_changed_called_;
@@ -2116,7 +2118,8 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
settings, this, &proxy_, &shared_bitmap_manager_,
&task_graph_runner_, &stats_instrumentation_);
host_impl_ = make_scoped_ptr(host_impl_override_time);
- host_impl_->InitializeRenderer(CreateOutputSurface());
+ output_surface_ = CreateOutputSurface();
+ host_impl_->InitializeRenderer(output_surface_.get());
SetupScrollAndContentsLayers(content_size);
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
@@ -5613,7 +5616,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
LayerTreeHostImpl::Create(
settings, this, &proxy_, &stats_instrumentation_,
&shared_bitmap_manager_, NULL, &task_graph_runner_, 0);
- layer_tree_host_impl->InitializeRenderer(output_surface.Pass());
+ layer_tree_host_impl->InitializeRenderer(output_surface.get());
layer_tree_host_impl->WillBeginImplFrame(
CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500));
@@ -5890,19 +5893,14 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
Proxy* proxy,
SharedBitmapManager* manager,
TaskGraphRunner* task_graph_runner,
- RenderingStatsInstrumentation* stats_instrumentation) {
- scoped_refptr<TestContextProvider> provider(TestContextProvider::Create());
- scoped_ptr<OutputSurface> output_surface(
- FakeOutputSurface::Create3d(provider));
- provider->BindToCurrentThread();
- provider->TestContext3d()->set_have_post_sub_buffer(true);
-
+ RenderingStatsInstrumentation* stats_instrumentation,
+ OutputSurface* output_surface) {
LayerTreeSettings settings;
settings.renderer_settings.partial_swap_enabled = partial_swap;
scoped_ptr<LayerTreeHostImpl> my_host_impl =
LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation,
manager, nullptr, task_graph_runner, 0);
- my_host_impl->InitializeRenderer(output_surface.Pass());
+ my_host_impl->InitializeRenderer(output_surface);
my_host_impl->WillBeginImplFrame(
CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
my_host_impl->SetViewportSize(gfx::Size(100, 100));
@@ -5965,9 +5963,14 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- scoped_ptr<LayerTreeHostImpl> my_host_impl =
- SetupLayersForOpacity(true, this, &proxy_, &shared_bitmap_manager,
- &task_graph_runner, &stats_instrumentation_);
+ scoped_refptr<TestContextProvider> provider(TestContextProvider::Create());
+ provider->BindToCurrentThread();
+ provider->TestContext3d()->set_have_post_sub_buffer(true);
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(provider));
+ scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity(
+ true, this, &proxy_, &shared_bitmap_manager, &task_graph_runner,
+ &stats_instrumentation_, output_surface.get());
{
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
@@ -5989,9 +5992,14 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) {
TestSharedBitmapManager shared_bitmap_manager;
TestTaskGraphRunner task_graph_runner;
- scoped_ptr<LayerTreeHostImpl> my_host_impl =
- SetupLayersForOpacity(false, this, &proxy_, &shared_bitmap_manager,
- &task_graph_runner, &stats_instrumentation_);
+ scoped_refptr<TestContextProvider> provider(TestContextProvider::Create());
+ provider->BindToCurrentThread();
+ provider->TestContext3d()->set_have_post_sub_buffer(true);
+ scoped_ptr<OutputSurface> output_surface(
+ FakeOutputSurface::Create3d(provider));
+ scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity(
+ false, this, &proxy_, &shared_bitmap_manager, &task_graph_runner,
+ &stats_instrumentation_, output_surface.get());
{
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
@@ -6410,9 +6418,9 @@ TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) {
settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_,
&gpu_memory_buffer_manager_, &task_graph_runner_, 0);
- scoped_ptr<OutputSurface> output_surface(
- FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()));
- host_impl_->InitializeRenderer(output_surface.Pass());
+ output_surface_ =
+ FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create());
+ host_impl_->InitializeRenderer(output_surface_.get());
EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes());
}
@@ -6473,7 +6481,8 @@ class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest {
new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_,
&shared_bitmap_manager_, &task_graph_runner_);
host_impl_.reset(fake_host_impl_);
- host_impl_->InitializeRenderer(CreateOutputSurface());
+ output_surface_ = CreateOutputSurface();
+ host_impl_->InitializeRenderer(output_surface_.get());
host_impl_->SetViewportSize(gfx::Size(10, 10));
}
@@ -8467,7 +8476,8 @@ class MockReclaimResourcesOutputSurface : public FakeOutputSurface {
public:
static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() {
return make_scoped_ptr(new MockReclaimResourcesOutputSurface(
- TestContextProvider::Create(), TestContextProvider::Create(), false));
+ TestContextProvider::Create(), TestContextProvider::CreateWorker(),
+ false));
}
MOCK_METHOD0(ForceReclaimResources, void());

Powered by Google App Engine
This is Rietveld 408576698