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

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

Issue 1259673002: Make UTF16ToASCII and UTF16TOUTF8 take a StringPiece (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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_dtmf_sender_handler.cc ('k') | content/renderer/npapi/webplugin_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 6bbbbfb589f53b25ae8d4a27769e2baa60a8ea12..2de508789f2b1050a5f9e62ffef495cf89cd1de8 100644
--- a/content/renderer/media/rtc_peer_connection_handler.cc
+++ b/content/renderer/media/rtc_peer_connection_handler.cc
@@ -181,8 +181,10 @@ void GetNativeRtcConfiguration(
webrtc::PeerConnectionInterface::IceServer server;
const blink::WebRTCICEServer& webkit_server =
blink_config.server(i);
- server.username = base::UTF16ToUTF8(webkit_server.username());
- server.password = base::UTF16ToUTF8(webkit_server.credential());
+ server.username =
+ base::UTF16ToUTF8(base::StringPiece16(webkit_server.username()));
+ server.password =
+ base::UTF16ToUTF8(base::StringPiece16(webkit_server.credential()));
server.uri = webkit_server.uri().spec();
webrtc_config->servers.push_back(server);
}
@@ -905,8 +907,9 @@ void RTCPeerConnectionHandler::setLocalDescription(
DCHECK(thread_checker_.CalledOnValidThread());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setLocalDescription");
- std::string sdp = base::UTF16ToUTF8(description.sdp());
- std::string type = base::UTF16ToUTF8(description.type());
+ std::string sdp = base::UTF16ToUTF8(base::StringPiece16(description.sdp()));
+ std::string type =
+ base::UTF16ToUTF8(base::StringPiece16(description.type()));
webrtc::SdpParseError error;
// Since CreateNativeSessionDescription uses the dependency factory, we need
@@ -947,8 +950,9 @@ void RTCPeerConnectionHandler::setRemoteDescription(
const blink::WebRTCSessionDescription& description) {
DCHECK(thread_checker_.CalledOnValidThread());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setRemoteDescription");
- std::string sdp = base::UTF16ToUTF8(description.sdp());
- std::string type = base::UTF16ToUTF8(description.type());
+ std::string sdp = base::UTF16ToUTF8(base::StringPiece16(description.sdp()));
+ std::string type =
+ base::UTF16ToUTF8(base::StringPiece16(description.type()));
webrtc::SdpParseError error;
// Since CreateNativeSessionDescription uses the dependency factory, we need
@@ -1063,9 +1067,9 @@ bool RTCPeerConnectionHandler::addICECandidate(
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate");
scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
dependency_factory_->CreateIceCandidate(
- base::UTF16ToUTF8(candidate.sdpMid()),
+ base::UTF16ToUTF8(base::StringPiece16(candidate.sdpMid())),
candidate.sdpMLineIndex(),
- base::UTF16ToUTF8(candidate.candidate())));
+ base::UTF16ToUTF8(base::StringPiece16(candidate.candidate()))));
bool return_value = false;
if (native_candidate) {
@@ -1219,7 +1223,8 @@ blink::WebRTCDataChannelHandler* RTCPeerConnectionHandler::createDataChannel(
const blink::WebString& label, const blink::WebRTCDataChannelInit& init) {
DCHECK(thread_checker_.CalledOnValidThread());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::createDataChannel");
- DVLOG(1) << "createDataChannel label " << base::UTF16ToUTF8(label);
+ DVLOG(1) << "createDataChannel label "
+ << base::UTF16ToUTF8(base::StringPiece16(label));
webrtc::DataChannelInit config;
// TODO(jiayl): remove the deprecated reliable field once Libjingle is updated
@@ -1230,11 +1235,11 @@ blink::WebRTCDataChannelHandler* RTCPeerConnectionHandler::createDataChannel(
config.negotiated = init.negotiated;
config.maxRetransmits = init.maxRetransmits;
config.maxRetransmitTime = init.maxRetransmitTime;
- config.protocol = base::UTF16ToUTF8(init.protocol);
+ config.protocol = base::UTF16ToUTF8(base::StringPiece16(init.protocol));
rtc::scoped_refptr<webrtc::DataChannelInterface> webrtc_channel(
- native_peer_connection_->CreateDataChannel(base::UTF16ToUTF8(label),
- &config));
+ native_peer_connection_->CreateDataChannel(
+ base::UTF16ToUTF8(base::StringPiece16(label)), &config));
if (!webrtc_channel) {
DLOG(ERROR) << "Could not create native data channel.";
return NULL;
« no previous file with comments | « content/renderer/media/rtc_dtmf_sender_handler.cc ('k') | content/renderer/npapi/webplugin_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698