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

Unified Diff: webrtc/api/datachannel.cc

Issue 1823503002: Reland Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/api/datachannel.cc
diff --git a/webrtc/api/datachannel.cc b/webrtc/api/datachannel.cc
index b4dc5d89130dc7bb5a98eed491fc009274e999b6..612d7e0b38256b27a00c0716645d825c1259e365 100644
--- a/webrtc/api/datachannel.cc
+++ b/webrtc/api/datachannel.cc
@@ -324,7 +324,7 @@ void DataChannel::OnMessage(rtc::Message* msg) {
void DataChannel::OnDataReceived(cricket::DataChannel* channel,
const cricket::ReceiveDataParams& params,
- const rtc::Buffer& payload) {
+ const rtc::CopyOnWriteBuffer& payload) {
uint32_t expected_ssrc =
(data_channel_type_ == cricket::DCT_RTP) ? receive_ssrc_ : config_.id;
if (params.ssrc != expected_ssrc) {
@@ -422,11 +422,11 @@ void DataChannel::UpdateState() {
}
if (connected_to_provider_) {
if (handshake_state_ == kHandshakeShouldSendOpen) {
- rtc::Buffer payload;
+ rtc::CopyOnWriteBuffer payload;
WriteDataChannelOpenMessage(label_, config_, &payload);
SendControlMessage(payload);
} else if (handshake_state_ == kHandshakeShouldSendAck) {
- rtc::Buffer payload;
+ rtc::CopyOnWriteBuffer payload;
WriteDataChannelOpenAckMessage(&payload);
SendControlMessage(payload);
}
@@ -595,11 +595,11 @@ void DataChannel::SendQueuedControlMessages() {
}
}
-void DataChannel::QueueControlMessage(const rtc::Buffer& buffer) {
+void DataChannel::QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer) {
queued_control_data_.Push(new DataBuffer(buffer, true));
}
-bool DataChannel::SendControlMessage(const rtc::Buffer& buffer) {
+bool DataChannel::SendControlMessage(const rtc::CopyOnWriteBuffer& buffer) {
bool is_open_message = handshake_state_ == kHandshakeShouldSendOpen;
ASSERT(data_channel_type_ == cricket::DCT_SCTP &&

Powered by Google App Engine
This is Rietveld 408576698