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

Side by Side Diff: content/renderer/media/rtc_data_channel_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/rtc_data_channel_handler.h" 5 #include "content/renderer/media/rtc_data_channel_handler.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 } 228 }
229 229
230 unsigned long RtcDataChannelHandler::bufferedAmount() { 230 unsigned long RtcDataChannelHandler::bufferedAmount() {
231 DCHECK(thread_checker_.CalledOnValidThread()); 231 DCHECK(thread_checker_.CalledOnValidThread());
232 return channel()->buffered_amount(); 232 return channel()->buffered_amount();
233 } 233 }
234 234
235 bool RtcDataChannelHandler::sendStringData(const blink::WebString& data) { 235 bool RtcDataChannelHandler::sendStringData(const blink::WebString& data) {
236 DCHECK(thread_checker_.CalledOnValidThread()); 236 DCHECK(thread_checker_.CalledOnValidThread());
237 std::string utf8_buffer = base::UTF16ToUTF8(data); 237 std::string utf8_buffer = base::UTF16ToUTF8(base::StringPiece16(data));
238 rtc::Buffer buffer(utf8_buffer.c_str(), utf8_buffer.length()); 238 rtc::Buffer buffer(utf8_buffer.c_str(), utf8_buffer.length());
239 webrtc::DataBuffer data_buffer(buffer, false); 239 webrtc::DataBuffer data_buffer(buffer, false);
240 RecordMessageSent(data_buffer.size()); 240 RecordMessageSent(data_buffer.size());
241 return channel()->Send(data_buffer); 241 return channel()->Send(data_buffer);
242 } 242 }
243 243
244 bool RtcDataChannelHandler::sendRawData(const char* data, size_t length) { 244 bool RtcDataChannelHandler::sendRawData(const char* data, size_t length) {
245 DCHECK(thread_checker_.CalledOnValidThread()); 245 DCHECK(thread_checker_.CalledOnValidThread());
246 rtc::Buffer buffer(data, length); 246 rtc::Buffer buffer(data, length);
247 webrtc::DataBuffer data_buffer(buffer, true); 247 webrtc::DataBuffer data_buffer(buffer, true);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 num_bytes, 324 num_bytes,
325 1, kMaxBucketSize, kNumBuckets); 325 1, kMaxBucketSize, kNumBuckets);
326 } else { 326 } else {
327 UMA_HISTOGRAM_CUSTOM_COUNTS("WebRTC.UnreliableDataChannelMessageSize", 327 UMA_HISTOGRAM_CUSTOM_COUNTS("WebRTC.UnreliableDataChannelMessageSize",
328 num_bytes, 328 num_bytes,
329 1, kMaxBucketSize, kNumBuckets); 329 1, kMaxBucketSize, kNumBuckets);
330 } 330 }
331 } 331 }
332 332
333 } // namespace content 333 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/peer_connection_tracker.cc ('k') | content/renderer/media/rtc_dtmf_sender_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698