Index: content/browser/renderer_host/media/peer_connection_tracker_host.cc |
diff --git a/content/browser/renderer_host/media/peer_connection_tracker_host.cc b/content/browser/renderer_host/media/peer_connection_tracker_host.cc |
index d4a8ac6b66e58097840d7be6acab4f58d63a57d5..ce55368c7008aa2176e061cec6cca9b236ea2ddc 100644 |
--- a/content/browser/renderer_host/media/peer_connection_tracker_host.cc |
+++ b/content/browser/renderer_host/media/peer_connection_tracker_host.cc |
@@ -4,9 +4,9 @@ |
#include "content/browser/renderer_host/media/peer_connection_tracker_host.h" |
#include "base/process_util.h" |
-#include "content/browser/media/webrtc_internals.h" |
#include "content/common/media/peer_connection_tracker_messages.h" |
#include "content/public/browser/content_browser_client.h" |
+#include "content/public/browser/webrtc_internals.h" |
namespace content { |
@@ -31,13 +31,32 @@ PeerConnectionTrackerHost::~PeerConnectionTrackerHost() { |
void PeerConnectionTrackerHost::OnAddPeerConnection( |
const PeerConnectionInfo& info) { |
- WebRTCInternals::GetInstance()->AddPeerConnection( |
- base::GetProcId(peer_handle()), info); |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(&PeerConnectionTrackerHost::OnAddPeerConnectionOnUIThread, |
jam
2013/01/18 18:27:33
why are you doing the dispatching manually instead
jiayl
2013/01/18 19:20:00
I tried using OverrideThreadForMessage and it didn
|
+ this, info)); |
+} |
+ |
+void PeerConnectionTrackerHost::OnAddPeerConnectionOnUIThread( |
+ const PeerConnectionInfo& info) { |
+ GetContentClient()->browser()->GetWebRTCInternals()-> |
+ AddPeerConnection(base::GetProcId(peer_handle()), |
+ info.lid, |
+ info.url, |
+ info.servers, |
+ info.constraints); |
} |
void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { |
- WebRTCInternals::GetInstance()->RemovePeerConnection( |
- base::GetProcId(peer_handle()), lid); |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(&PeerConnectionTrackerHost::OnRemovePeerConnectionOnUIThread, |
+ this, lid)); |
+} |
+ |
+void PeerConnectionTrackerHost::OnRemovePeerConnectionOnUIThread(int lid) { |
+ GetContentClient()->browser()->GetWebRTCInternals()-> |
+ RemovePeerConnection(base::GetProcId(peer_handle()), lid); |
} |
} // namespace content |