summaryrefslogtreecommitdiffstats
path: root/cc/resources
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 03:22:19 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 03:22:19 +0000
commit41b53ac72fcfe430e816cea48a32bb00e346547f (patch)
tree0f3f1f082451247693dba41dcb919d270991c96a /cc/resources
parent887dc5d85a487e0a071099b58f1ea2235602a0ab (diff)
downloadchromium_src-41b53ac72fcfe430e816cea48a32bb00e346547f.zip
chromium_src-41b53ac72fcfe430e816cea48a32bb00e346547f.tar.gz
chromium_src-41b53ac72fcfe430e816cea48a32bb00e346547f.tar.bz2
cc: Allow DeferredInitialize to use DelegatingRenderer
Currently DeferredInitialize assumes OutputSurface never has delegated_rendering capability. With this change, remove this assumption by always first creating SoftwareRenderer for OutputSurface with deferred_gl_initialization. Then create either DelegatingRenderer or GLRenderer depending on delegated_rendering capability in DeferredInitialize. With support for DelegatingRenderer and DeferredInititalize, have to ensure that all GL resources are returned to child before ReleasGL is called, because ContextProvider is going away after ReleaseGL. Add a DCHECK for this in ResourceProvider::CleanUpGLIfNeeded. New path covered by LayerTreeHostTestDeferredInitialize. BUG=344087 Review URL: https://codereview.chromium.org/286953008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources')
-rw-r--r--cc/resources/resource_provider.cc9
-rw-r--r--cc/resources/resource_provider_unittest.cc6
2 files changed, 13 insertions, 2 deletions
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 09b12a3..de683e7 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -1321,6 +1321,15 @@ void ResourceProvider::CleanUpGLIfNeeded() {
}
DCHECK(gl);
+#if DCHECK_IS_ON
+ // Check that all GL resources has been deleted.
+ for (ResourceMap::const_iterator itr = resources_.begin();
+ itr != resources_.end();
+ ++itr) {
+ DCHECK_NE(GLTexture, itr->second.type);
+ }
+#endif // DCHECK_IS_ON
+
texture_uploader_.reset();
texture_id_allocator_.reset();
buffer_id_allocator_.reset();
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index 547bdbb..4bf9ec0 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -3185,10 +3185,12 @@ void InitializeGLAndCheck(ContextSharedData* shared_data,
TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create();
- FakeOutputSurfaceClient client;
+ bool delegated_rendering = false;
scoped_ptr<FakeOutputSurface> output_surface(
FakeOutputSurface::CreateDeferredGL(
- scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)));
+ scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice),
+ delegated_rendering));
+ FakeOutputSurfaceClient client(output_surface.get());
EXPECT_TRUE(output_surface->BindToClient(&client));
scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
new TestSharedBitmapManager());