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

Side by Side Diff: content/browser/renderer_host/media/peer_connection_tracker_host.cc

Issue 11876007: Connecting webrtc-internals WebUI frontend with the backend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@main
Patch Set: Moving ChromeWebRTCInternals to UI thread Created 7 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" 4 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h"
5 5
6 #include "base/process_util.h" 6 #include "base/process_util.h"
7 #include "content/browser/media/webrtc_internals.h"
8 #include "content/common/media/peer_connection_tracker_messages.h" 7 #include "content/common/media/peer_connection_tracker_messages.h"
9 #include "content/public/browser/content_browser_client.h" 8 #include "content/public/browser/content_browser_client.h"
9 #include "content/public/browser/webrtc_internals.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 PeerConnectionTrackerHost::PeerConnectionTrackerHost() { 13 PeerConnectionTrackerHost::PeerConnectionTrackerHost() {
14 } 14 }
15 15
16 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message, 16 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message,
17 bool* message_was_ok) { 17 bool* message_was_ok) {
18 bool handled = true; 18 bool handled = true;
19 IPC_BEGIN_MESSAGE_MAP_EX(PeerConnectionTrackerHost, message, *message_was_ok) 19 IPC_BEGIN_MESSAGE_MAP_EX(PeerConnectionTrackerHost, message, *message_was_ok)
20 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, 20 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection,
21 OnAddPeerConnection) 21 OnAddPeerConnection)
22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, 22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection,
23 OnRemovePeerConnection) 23 OnRemovePeerConnection)
24 IPC_MESSAGE_UNHANDLED(handled = false) 24 IPC_MESSAGE_UNHANDLED(handled = false)
25 IPC_END_MESSAGE_MAP_EX() 25 IPC_END_MESSAGE_MAP_EX()
26 return handled; 26 return handled;
27 } 27 }
28 28
29 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() { 29 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() {
30 } 30 }
31 31
32 void PeerConnectionTrackerHost::OnAddPeerConnection( 32 void PeerConnectionTrackerHost::OnAddPeerConnection(
33 const PeerConnectionInfo& info) { 33 const PeerConnectionInfo& info) {
34 WebRTCInternals::GetInstance()->AddPeerConnection( 34 BrowserThread::PostTask(
35 base::GetProcId(peer_handle()), info); 35 BrowserThread::UI, FROM_HERE,
36 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
37 this, info));
38 }
39
40 void PeerConnectionTrackerHost::OnAddPeerConnectionOnUIThread(
41 const PeerConnectionInfo& info) {
42 GetContentClient()->browser()->GetWebRTCInternals()->
43 AddPeerConnection(base::GetProcId(peer_handle()),
44 info.lid,
45 info.url,
46 info.servers,
47 info.constraints);
36 } 48 }
37 49
38 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { 50 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) {
39 WebRTCInternals::GetInstance()->RemovePeerConnection( 51 BrowserThread::PostTask(
40 base::GetProcId(peer_handle()), lid); 52 BrowserThread::UI, FROM_HERE,
53 base::Bind(&PeerConnectionTrackerHost::OnRemovePeerConnectionOnUIThread,
54 this, lid));
55 }
56
57 void PeerConnectionTrackerHost::OnRemovePeerConnectionOnUIThread(int lid) {
58 GetContentClient()->browser()->GetWebRTCInternals()->
59 RemovePeerConnection(base::GetProcId(peer_handle()), lid);
41 } 60 }
42 61
43 } // namespace content 62 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698