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

Side by Side Diff: cc/layers/nine_patch_layer_unittest.cc

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/io_surface_layer_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/nine_patch_layer.h" 5 #include "cc/layers/nine_patch_layer.h"
6 6
7 #include "cc/debug/overdraw_metrics.h" 7 #include "cc/debug/overdraw_metrics.h"
8 #include "cc/resources/prioritized_resource_manager.h" 8 #include "cc/resources/prioritized_resource_manager.h"
9 #include "cc/resources/resource_provider.h" 9 #include "cc/resources/resource_provider.h"
10 #include "cc/resources/resource_update_queue.h" 10 #include "cc/resources/resource_update_queue.h"
11 #include "cc/scheduler/texture_uploader.h" 11 #include "cc/scheduler/texture_uploader.h"
12 #include "cc/test/fake_layer_tree_host_client.h" 12 #include "cc/test/fake_layer_tree_host_client.h"
13 #include "cc/test/fake_output_surface.h" 13 #include "cc/test/fake_output_surface.h"
14 #include "cc/test/fake_output_surface_client.h"
14 #include "cc/test/geometry_test_utils.h" 15 #include "cc/test/geometry_test_utils.h"
15 #include "cc/trees/layer_tree_host.h" 16 #include "cc/trees/layer_tree_host.h"
16 #include "cc/trees/occlusion_tracker.h" 17 #include "cc/trees/occlusion_tracker.h"
17 #include "cc/trees/single_thread_proxy.h" 18 #include "cc/trees/single_thread_proxy.h"
18 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
21 22
22 using ::testing::Mock; 23 using ::testing::Mock;
23 using ::testing::_; 24 using ::testing::_;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_EQ(1u, queue.FullUploadSize()); 89 EXPECT_EQ(1u, queue.FullUploadSize());
89 EXPECT_EQ(0u, queue.PartialUploadSize()); 90 EXPECT_EQ(0u, queue.PartialUploadSize());
90 ResourceUpdate params = queue.TakeFirstFullUpload(); 91 ResourceUpdate params = queue.TakeFirstFullUpload();
91 EXPECT_TRUE(params.texture != NULL); 92 EXPECT_TRUE(params.texture != NULL);
92 93
93 // Upload the texture. 94 // Upload the texture.
94 layer_tree_host_->contents_texture_manager()->SetMaxMemoryLimitBytes( 95 layer_tree_host_->contents_texture_manager()->SetMaxMemoryLimitBytes(
95 1024 * 1024); 96 1024 * 1024);
96 layer_tree_host_->contents_texture_manager()->PrioritizeTextures(); 97 layer_tree_host_->contents_texture_manager()->PrioritizeTextures();
97 98
99 FakeOutputSurfaceClient output_surface_client;
98 scoped_ptr<OutputSurface> output_surface; 100 scoped_ptr<OutputSurface> output_surface;
99 scoped_ptr<ResourceProvider> resource_provider; 101 scoped_ptr<ResourceProvider> resource_provider;
100 { 102 {
101 DebugScopedSetImplThread impl_thread(Proxy()); 103 DebugScopedSetImplThread impl_thread(Proxy());
102 DebugScopedSetMainThreadBlocked main_thread_blocked(Proxy()); 104 DebugScopedSetMainThreadBlocked main_thread_blocked(Proxy());
103 output_surface = CreateFakeOutputSurface(); 105 output_surface = FakeOutputSurface::Create3d();
106 CHECK(output_surface->BindToClient(&output_surface_client));
104 resource_provider = ResourceProvider::Create(output_surface.get(), 0); 107 resource_provider = ResourceProvider::Create(output_surface.get(), 0);
105 params.texture->AcquireBackingTexture(resource_provider.get()); 108 params.texture->AcquireBackingTexture(resource_provider.get());
106 ASSERT_TRUE(params.texture->have_backing_texture()); 109 ASSERT_TRUE(params.texture->have_backing_texture());
107 } 110 }
108 111
109 // Nothing changed, so no repeated upload. 112 // Nothing changed, so no repeated upload.
110 test_layer->SavePaintProperties(); 113 test_layer->SavePaintProperties();
111 test_layer->SetTexturePriorities(calculator); 114 test_layer->SetTexturePriorities(calculator);
112 test_layer->Update(&queue, &occlusion_tracker); 115 test_layer->Update(&queue, &occlusion_tracker);
113 EXPECT_EQ(0u, queue.FullUploadSize()); 116 EXPECT_EQ(0u, queue.FullUploadSize());
(...skipping 23 matching lines...) Expand all
137 EXPECT_EQ(1u, queue2.FullUploadSize()); 140 EXPECT_EQ(1u, queue2.FullUploadSize());
138 EXPECT_EQ(0u, queue2.PartialUploadSize()); 141 EXPECT_EQ(0u, queue2.PartialUploadSize());
139 params = queue2.TakeFirstFullUpload(); 142 params = queue2.TakeFirstFullUpload();
140 EXPECT_TRUE(params.texture != NULL); 143 EXPECT_TRUE(params.texture != NULL);
141 EXPECT_EQ(params.texture->resource_manager(), 144 EXPECT_EQ(params.texture->resource_manager(),
142 layer_tree_host_->contents_texture_manager()); 145 layer_tree_host_->contents_texture_manager());
143 } 146 }
144 147
145 } // namespace 148 } // namespace
146 } // namespace cc 149 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/io_surface_layer_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698