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

Unified Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 292163002: Destroy all rtc peer connection handlers before shutting down blink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | « content/renderer/media/rtc_peer_connection_handler.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/rtc_peer_connection_handler.cc
diff --git a/content/renderer/media/rtc_peer_connection_handler.cc b/content/renderer/media/rtc_peer_connection_handler.cc
index f44e08e571123134410361949783880ba07ec364..687e887e1a7e0dbc7f1f6208c9a3e45e402841e4 100644
--- a/content/renderer/media/rtc_peer_connection_handler.cc
+++ b/content/renderer/media/rtc_peer_connection_handler.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
@@ -317,6 +318,8 @@ void LocalRTCStatsResponse::addStatistic(size_t report,
impl_.addStatistic(report, name, value);
}
+namespace {
+
class PeerConnectionUMAObserver : public webrtc::UMAObserver {
public:
PeerConnectionUMAObserver() {}
@@ -351,6 +354,11 @@ class PeerConnectionUMAObserver : public webrtc::UMAObserver {
}
};
+base::LazyInstance<std::set<RTCPeerConnectionHandler*> >::Leaky
+ g_peer_connection_handlers = LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
RTCPeerConnectionHandler::RTCPeerConnectionHandler(
blink::WebRTCPeerConnectionHandlerClient* client,
PeerConnectionDependencyFactory* dependency_factory)
@@ -359,9 +367,11 @@ RTCPeerConnectionHandler::RTCPeerConnectionHandler(
frame_(NULL),
peer_connection_tracker_(NULL),
num_data_channels_created_(0) {
+ g_peer_connection_handlers.Get().insert(this);
}
RTCPeerConnectionHandler::~RTCPeerConnectionHandler() {
+ g_peer_connection_handlers.Get().erase(this);
if (peer_connection_tracker_)
peer_connection_tracker_->UnregisterPeerConnection(this);
STLDeleteValues(&remote_streams_);
@@ -370,6 +380,18 @@ RTCPeerConnectionHandler::~RTCPeerConnectionHandler() {
"WebRTC.NumDataChannelsPerPeerConnection", num_data_channels_created_);
}
+// static
+void RTCPeerConnectionHandler::DestructAllHandlers() {
+ std::set<RTCPeerConnectionHandler*> handlers(
+ g_peer_connection_handlers.Get().begin(),
+ g_peer_connection_handlers.Get().end());
+ for (std::set<RTCPeerConnectionHandler*>::iterator handler = handlers.begin();
+ handler != handlers.end();
+ ++handler) {
+ (*handler)->client_->releasePeerConnectionHandler();
+ }
+}
+
void RTCPeerConnectionHandler::associateWithFrame(blink::WebFrame* frame) {
DCHECK(frame);
frame_ = frame;
« no previous file with comments | « content/renderer/media/rtc_peer_connection_handler.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698