Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_TRACKER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_TRACKER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_TRACKER_H_ | 6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 RTCPeerConnectionHandler* pc_handler, | 156 RTCPeerConnectionHandler* pc_handler, |
| 157 const blink::WebMediaStreamTrack& track); | 157 const blink::WebMediaStreamTrack& track); |
| 158 | 158 |
| 159 // Sends an update when getUserMedia is called. | 159 // Sends an update when getUserMedia is called. |
| 160 virtual void TrackGetUserMedia( | 160 virtual void TrackGetUserMedia( |
| 161 const blink::WebUserMediaRequest& user_media_request); | 161 const blink::WebUserMediaRequest& user_media_request); |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 // Assign a local ID to a peer connection so that the browser process can | 164 // Assign a local ID to a peer connection so that the browser process can |
| 165 // uniquely identify a peer connection in the renderer process. | 165 // uniquely identify a peer connection in the renderer process. |
| 166 // The return value will always be positive. | |
| 166 int GetNextLocalID(); | 167 int GetNextLocalID(); |
| 167 | 168 |
| 169 // Looks up a handler in our map and if found, returns its ID. If the handler | |
| 170 // is not registered, the return value will be -1. | |
| 171 int GetLocalIDForHandler(RTCPeerConnectionHandler* handler) const; | |
| 172 | |
| 168 // IPC Message handler for getting all stats. | 173 // IPC Message handler for getting all stats. |
| 169 void OnGetAllStats(); | 174 void OnGetAllStats(); |
| 170 | 175 |
| 171 // Called when the browser process reports a suspend event from the OS. | 176 // Called when the browser process reports a suspend event from the OS. |
| 172 void OnSuspend(); | 177 void OnSuspend(); |
| 173 | 178 |
| 174 void SendPeerConnectionUpdate(RTCPeerConnectionHandler* pc_handler, | 179 void SendPeerConnectionUpdate(int local_id, |
|
Henrik Grunell
2016/02/08 09:52:08
Nit: Would be great to add a comment for this func
tommi (sloooow) - chröme
2016/02/08 13:50:23
Done.
Henrik Grunell
2016/02/09 08:18:11
Great comment. Thanks!
| |
| 175 const std::string& callback_type, | 180 const char* callback_type, |
| 176 const std::string& value); | 181 const std::string& value); |
| 177 | 182 |
| 178 // This map stores the local ID assigned to each RTCPeerConnectionHandler. | 183 // This map stores the local ID assigned to each RTCPeerConnectionHandler. |
| 179 typedef std::map<RTCPeerConnectionHandler*, int> PeerConnectionIdMap; | 184 typedef std::map<RTCPeerConnectionHandler*, int> PeerConnectionIdMap; |
| 180 PeerConnectionIdMap peer_connection_id_map_; | 185 PeerConnectionIdMap peer_connection_id_map_; |
| 181 | 186 |
| 182 // This keeps track of the next available local ID. | 187 // This keeps track of the next available local ID. |
| 183 int next_lid_; | 188 int next_lid_; |
| 184 base::ThreadChecker main_thread_; | 189 base::ThreadChecker main_thread_; |
| 185 | 190 |
| 186 DISALLOW_COPY_AND_ASSIGN(PeerConnectionTracker); | 191 DISALLOW_COPY_AND_ASSIGN(PeerConnectionTracker); |
| 187 }; | 192 }; |
| 188 | 193 |
| 189 } // namespace content | 194 } // namespace content |
| 190 | 195 |
| 191 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_TRACKER_H_ | 196 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_TRACKER_H_ |
| OLD | NEW |