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

Side by Side Diff: content/renderer/media/peer_connection_tracker.cc

Issue 2832263004: Fixing some strings that go into webrtc-internals. (Closed)
Patch Set: Use different enum names between C++ and JS. Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 #include "content/renderer/media/peer_connection_tracker.h" 5 #include "content/renderer/media/peer_connection_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 default: 170 default:
171 NOTREACHED(); 171 NOTREACHED();
172 }; 172 };
173 return policy_str; 173 return policy_str;
174 } 174 }
175 175
176 static std::string SerializeConfiguration( 176 static std::string SerializeConfiguration(
177 const webrtc::PeerConnectionInterface::RTCConfiguration& config) { 177 const webrtc::PeerConnectionInterface::RTCConfiguration& config) {
178 std::ostringstream oss; 178 std::ostringstream oss;
179 // TODO(hbos): Add serialization of certificate. 179 // TODO(hbos): Add serialization of certificate.
180 oss << "{ iceServers: " << SerializeServers(config.servers) << ", " 180 oss << "{ iceServers: " << SerializeServers(config.servers)
181 << "iceTransportPolicy: " << SerializeIceTransportType(config.type) 181 << ", iceTransportPolicy: " << SerializeIceTransportType(config.type)
182 << ", " 182 << ", bundlePolicy: " << SerializeBundlePolicy(config.bundle_policy)
183 << "bundlePolicy: " << SerializeBundlePolicy(config.bundle_policy) << ", " 183 << ", rtcpMuxPolicy: " << SerializeRtcpMuxPolicy(config.rtcp_mux_policy)
184 << "rtcpMuxPolicy: " << SerializeRtcpMuxPolicy(config.rtcp_mux_policy) 184 << ", iceCandidatePoolSize: " << config.ice_candidate_pool_size << " }";
185 << "iceCandidatePoolSize: " << config.ice_candidate_pool_size << " }";
186 return oss.str(); 185 return oss.str();
187 } 186 }
188 187
189 #define GET_STRING_OF_STATE(state) \ 188 #define GET_STRING_OF_STATE(state) \
190 case WebRTCPeerConnectionHandlerClient::state: \ 189 case WebRTCPeerConnectionHandlerClient::k##state: \
191 result = #state; \ 190 result = #state; \
192 break; 191 break;
193 192
193 // Note: All of these strings need to be kept in sync with
194 // peer_connection_update_table.js, in order to be displayed as friendly
195 // strings on chrome://webrtc-internals.
196
194 static const char* GetSignalingStateString( 197 static const char* GetSignalingStateString(
195 WebRTCPeerConnectionHandlerClient::SignalingState state) { 198 WebRTCPeerConnectionHandlerClient::SignalingState state) {
196 const char* result = ""; 199 const char* result = "";
197 switch (state) { 200 switch (state) {
198 GET_STRING_OF_STATE(kSignalingStateStable) 201 GET_STRING_OF_STATE(SignalingStateStable)
199 GET_STRING_OF_STATE(kSignalingStateHaveLocalOffer) 202 GET_STRING_OF_STATE(SignalingStateHaveLocalOffer)
200 GET_STRING_OF_STATE(kSignalingStateHaveRemoteOffer) 203 GET_STRING_OF_STATE(SignalingStateHaveRemoteOffer)
201 GET_STRING_OF_STATE(kSignalingStateHaveLocalPrAnswer) 204 GET_STRING_OF_STATE(SignalingStateHaveLocalPrAnswer)
202 GET_STRING_OF_STATE(kSignalingStateHaveRemotePrAnswer) 205 GET_STRING_OF_STATE(SignalingStateHaveRemotePrAnswer)
203 GET_STRING_OF_STATE(kSignalingStateClosed) 206 GET_STRING_OF_STATE(SignalingStateClosed)
204 default: 207 default:
205 NOTREACHED(); 208 NOTREACHED();
206 break; 209 break;
207 } 210 }
208 return result; 211 return result;
209 } 212 }
210 213
211 static const char* GetIceConnectionStateString( 214 static const char* GetIceConnectionStateString(
212 WebRTCPeerConnectionHandlerClient::ICEConnectionState state) { 215 WebRTCPeerConnectionHandlerClient::ICEConnectionState state) {
213 const char* result = ""; 216 const char* result = "";
214 switch (state) { 217 switch (state) {
215 GET_STRING_OF_STATE(kICEConnectionStateStarting) 218 GET_STRING_OF_STATE(ICEConnectionStateStarting)
216 GET_STRING_OF_STATE(kICEConnectionStateChecking) 219 GET_STRING_OF_STATE(ICEConnectionStateChecking)
217 GET_STRING_OF_STATE(kICEConnectionStateConnected) 220 GET_STRING_OF_STATE(ICEConnectionStateConnected)
218 GET_STRING_OF_STATE(kICEConnectionStateCompleted) 221 GET_STRING_OF_STATE(ICEConnectionStateCompleted)
219 GET_STRING_OF_STATE(kICEConnectionStateFailed) 222 GET_STRING_OF_STATE(ICEConnectionStateFailed)
220 GET_STRING_OF_STATE(kICEConnectionStateDisconnected) 223 GET_STRING_OF_STATE(ICEConnectionStateDisconnected)
221 GET_STRING_OF_STATE(kICEConnectionStateClosed) 224 GET_STRING_OF_STATE(ICEConnectionStateClosed)
222 default: 225 default:
223 NOTREACHED(); 226 NOTREACHED();
224 break; 227 break;
225 } 228 }
226 return result; 229 return result;
227 } 230 }
228 231
229 static const char* GetIceGatheringStateString( 232 static const char* GetIceGatheringStateString(
230 WebRTCPeerConnectionHandlerClient::ICEGatheringState state) { 233 WebRTCPeerConnectionHandlerClient::ICEGatheringState state) {
231 const char* result = ""; 234 const char* result = "";
232 switch (state) { 235 switch (state) {
233 GET_STRING_OF_STATE(kICEGatheringStateNew) 236 GET_STRING_OF_STATE(ICEGatheringStateNew)
234 GET_STRING_OF_STATE(kICEGatheringStateGathering) 237 GET_STRING_OF_STATE(ICEGatheringStateGathering)
235 GET_STRING_OF_STATE(kICEGatheringStateComplete) 238 GET_STRING_OF_STATE(ICEGatheringStateComplete)
236 default: 239 default:
237 NOTREACHED(); 240 NOTREACHED();
238 break; 241 break;
239 } 242 }
240 return result; 243 return result;
241 } 244 }
242 245
243 // Builds a DictionaryValue from the StatsReport. 246 // Builds a DictionaryValue from the StatsReport.
244 // The caller takes the ownership of the returned value. 247 // The caller takes the ownership of the returned value.
245 // Note: 248 // Note:
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 DCHECK(main_thread_.CalledOnValidThread()); 743 DCHECK(main_thread_.CalledOnValidThread());
741 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( 744 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection(
742 local_id, std::string(callback_type), value)); 745 local_id, std::string(callback_type), value));
743 } 746 }
744 747
745 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { 748 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) {
746 send_target_for_test_ = target; 749 send_target_for_test_ = target;
747 } 750 }
748 751
749 } // namespace content 752 } // namespace content
OLDNEW
« 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