OLD | NEW |
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/logging.h" | 10 #include "base/logging.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 unsigned short RtcDataChannelHandler::id() const { | 96 unsigned short RtcDataChannelHandler::id() const { |
97 return channel_->id(); | 97 return channel_->id(); |
98 } | 98 } |
99 | 99 |
100 unsigned long RtcDataChannelHandler::bufferedAmount() { | 100 unsigned long RtcDataChannelHandler::bufferedAmount() { |
101 return channel_->buffered_amount(); | 101 return channel_->buffered_amount(); |
102 } | 102 } |
103 | 103 |
104 bool RtcDataChannelHandler::sendStringData(const blink::WebString& data) { | 104 bool RtcDataChannelHandler::sendStringData(const blink::WebString& data) { |
105 std::string utf8_buffer = base::UTF16ToUTF8(data); | 105 std::string utf8_buffer = base::UTF16ToUTF8(data); |
106 talk_base::Buffer buffer(utf8_buffer.c_str(), utf8_buffer.length()); | 106 rtc::Buffer buffer(utf8_buffer.c_str(), utf8_buffer.length()); |
107 webrtc::DataBuffer data_buffer(buffer, false); | 107 webrtc::DataBuffer data_buffer(buffer, false); |
108 RecordMessageSent(data_buffer.size()); | 108 RecordMessageSent(data_buffer.size()); |
109 return channel_->Send(data_buffer); | 109 return channel_->Send(data_buffer); |
110 } | 110 } |
111 | 111 |
112 bool RtcDataChannelHandler::sendRawData(const char* data, size_t length) { | 112 bool RtcDataChannelHandler::sendRawData(const char* data, size_t length) { |
113 talk_base::Buffer buffer(data, length); | 113 rtc::Buffer buffer(data, length); |
114 webrtc::DataBuffer data_buffer(buffer, true); | 114 webrtc::DataBuffer data_buffer(buffer, true); |
115 RecordMessageSent(data_buffer.size()); | 115 RecordMessageSent(data_buffer.size()); |
116 return channel_->Send(data_buffer); | 116 return channel_->Send(data_buffer); |
117 } | 117 } |
118 | 118 |
119 void RtcDataChannelHandler::close() { | 119 void RtcDataChannelHandler::close() { |
120 channel_->Close(); | 120 channel_->Close(); |
121 } | 121 } |
122 | 122 |
123 void RtcDataChannelHandler::OnStateChange() { | 123 void RtcDataChannelHandler::OnStateChange() { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 num_bytes, | 186 num_bytes, |
187 1, kMaxBucketSize, kNumBuckets); | 187 1, kMaxBucketSize, kNumBuckets); |
188 } else { | 188 } else { |
189 UMA_HISTOGRAM_CUSTOM_COUNTS("WebRTC.UnreliableDataChannelMessageSize", | 189 UMA_HISTOGRAM_CUSTOM_COUNTS("WebRTC.UnreliableDataChannelMessageSize", |
190 num_bytes, | 190 num_bytes, |
191 1, kMaxBucketSize, kNumBuckets); | 191 1, kMaxBucketSize, kNumBuckets); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 } // namespace content | 195 } // namespace content |
OLD | NEW |