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

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

Issue 1036653004: Use rtc::Buffer::size() instead of rtc::Buffer::length() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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) 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void RtcDataChannelHandler::OnMessage(scoped_ptr<webrtc::DataBuffer> buffer) { 286 void RtcDataChannelHandler::OnMessage(scoped_ptr<webrtc::DataBuffer> buffer) {
287 DCHECK(thread_checker_.CalledOnValidThread()); 287 DCHECK(thread_checker_.CalledOnValidThread());
288 if (!webkit_client_) { 288 if (!webkit_client_) {
289 // If this happens, the web application will not get notified of changes. 289 // If this happens, the web application will not get notified of changes.
290 NOTREACHED() << "WebRTCDataChannelHandlerClient not set."; 290 NOTREACHED() << "WebRTCDataChannelHandlerClient not set.";
291 return; 291 return;
292 } 292 }
293 293
294 if (buffer->binary) { 294 if (buffer->binary) {
295 webkit_client_->didReceiveRawData(buffer->data.data(), 295 webkit_client_->didReceiveRawData(buffer->data.data(),
296 buffer->data.length()); 296 buffer->data.size());
297 } else { 297 } else {
298 base::string16 utf16; 298 base::string16 utf16;
299 if (!base::UTF8ToUTF16(buffer->data.data(), buffer->data.length(), 299 if (!base::UTF8ToUTF16(buffer->data.data(), buffer->data.size(),
300 &utf16)) { 300 &utf16)) {
301 LOG(ERROR) << "Failed convert received data to UTF16"; 301 LOG(ERROR) << "Failed convert received data to UTF16";
302 return; 302 return;
303 } 303 }
304 webkit_client_->didReceiveStringData(utf16); 304 webkit_client_->didReceiveStringData(utf16);
305 } 305 }
306 } 306 }
307 307
308 void RtcDataChannelHandler::RecordMessageSent(size_t num_bytes) { 308 void RtcDataChannelHandler::RecordMessageSent(size_t num_bytes) {
309 DCHECK(thread_checker_.CalledOnValidThread()); 309 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 14 matching lines...) Expand all
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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698