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

Unified Diff: content/renderer/media/android/stream_texture_factory_synchronous_impl.cc

Issue 594273003: aw: Prevent multiple AddObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
diff --git a/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc b/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
index e46395d0cd1de7a1a380dbe88147be471fba60a6..093012a150750aef59e9cc591d0dff6550b99ce6 100644
--- a/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
+++ b/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc
@@ -166,13 +166,14 @@ StreamTextureFactorySynchronousImpl::StreamTextureFactorySynchronousImpl(
StreamTextureFactorySynchronousImpl::~StreamTextureFactorySynchronousImpl() {}
StreamTextureProxy* StreamTextureFactorySynchronousImpl::CreateProxy() {
- if (!context_provider_)
+ bool had_proxy = !!context_provider_;
+ if (!had_proxy)
context_provider_ = create_context_provider_callback_.Run();
if (!context_provider_)
return NULL;
- if (observer_)
+ if (observer_ && !had_proxy)
context_provider_->AddObserver(observer_);
return new StreamTextureProxyImpl(context_provider_);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698