diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-17 02:29:07 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-17 02:29:07 +0000 |
commit | abe67aea176f8755ad50b335d0dc462ba356dc74 (patch) | |
tree | ca4f523dacd7b04602f14e690839c3a9938d88a1 /cc/debug | |
parent | ff903e17d6cb6e6629fd8cd004fe09023145abb1 (diff) | |
download | chromium_src-abe67aea176f8755ad50b335d0dc462ba356dc74.zip chromium_src-abe67aea176f8755ad50b335d0dc462ba356dc74.tar.gz chromium_src-abe67aea176f8755ad50b335d0dc462ba356dc74.tar.bz2 |
cc: Don't leak the texture returned in CopyOutputRequest ever.
Currently we use a WeakPtr on the GLRenderer to prevent crashing
if the GLRenderer goes away before the embedder is done with the
texture returned in the CopyOutputRequest.
But if the GLRenderer goes away, we just leak the texture. :(
So, now that we have ContextProvider available, we hold a ref
on the provider inside the Callback, and this way we can always
destroy the texture when it is released. :)
Also, we can remove the WeakPtrFactory from GLRenderer.
R=piman
BUG=255634
Review URL: https://chromiumcodereview.appspot.com/22852006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/debug')
-rw-r--r-- | cc/debug/test_context_provider.cc | 15 | ||||
-rw-r--r-- | cc/debug/test_context_provider.h | 8 |
2 files changed, 22 insertions, 1 deletions
diff --git a/cc/debug/test_context_provider.cc b/cc/debug/test_context_provider.cc index 55fc74f..613ef53 100644 --- a/cc/debug/test_context_provider.cc +++ b/cc/debug/test_context_provider.cc @@ -175,6 +175,21 @@ void TestContextProvider::OnSwapBuffersComplete() { swap_buffers_complete_callback_.Run(); } +TestWebGraphicsContext3D* TestContextProvider::TestContext3d() { + DCHECK(context3d_); + DCHECK(bound_); + DCHECK(context_thread_checker_.CalledOnValidThread()); + + return context3d_.get(); +} + +TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { + DCHECK(context3d_); + DCHECK(context_thread_checker_.CalledOnValidThread()); + + return context3d_.get(); +} + void TestContextProvider::SetMemoryAllocation( const ManagedMemoryPolicy& policy, bool discard_backbuffer_when_not_visible) { diff --git a/cc/debug/test_context_provider.h b/cc/debug/test_context_provider.h index 3e677049..af3e599 100644 --- a/cc/debug/test_context_provider.h +++ b/cc/debug/test_context_provider.h @@ -40,7 +40,13 @@ class CC_EXPORT TestContextProvider virtual void SetMemoryPolicyChangedCallback( const MemoryPolicyChangedCallback& cb) OVERRIDE; - TestWebGraphicsContext3D* TestContext3d() { return context3d_.get(); } + TestWebGraphicsContext3D* TestContext3d(); + + // This returns the TestWebGraphicsContext3D but is valid to call + // before the context is bound to a thread. This is needed to set up + // state on the test context before binding. Don't call + // makeContextCurrent on the context returned from this method. + TestWebGraphicsContext3D* UnboundTestContext3d(); void SetMemoryAllocation(const ManagedMemoryPolicy& policy, bool discard_backbuffer_when_not_visible); |