Reland Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies.
This CL removes copy and assign support from Buffer and changes various
parameters from Buffer to CopyOnWriteBuffer so they can be passed along
and copied without actually copying the underlying data.
With this changed some parameters to be "const" and fixed an issue when
creating a CopyOnWriteBuffer with empty data.
BUG=webrtc:5155
Review URL: https://codereview.webrtc.org/1823503002
Cr-Commit-Position: refs/heads/master@{#12062}
diff --git a/webrtc/api/sctputils.h b/webrtc/api/sctputils.h
index ffbade2..2fb1943 100644
--- a/webrtc/api/sctputils.h
+++ b/webrtc/api/sctputils.h
@@ -16,26 +16,26 @@
#include "webrtc/api/datachannelinterface.h"
namespace rtc {
-class Buffer;
+class CopyOnWriteBuffer;
} // namespace rtc
namespace webrtc {
struct DataChannelInit;
// Read the message type and return true if it's an OPEN message.
-bool IsOpenMessage(const rtc::Buffer& payload);
+bool IsOpenMessage(const rtc::CopyOnWriteBuffer& payload);
-bool ParseDataChannelOpenMessage(const rtc::Buffer& payload,
+bool ParseDataChannelOpenMessage(const rtc::CopyOnWriteBuffer& payload,
std::string* label,
DataChannelInit* config);
-bool ParseDataChannelOpenAckMessage(const rtc::Buffer& payload);
+bool ParseDataChannelOpenAckMessage(const rtc::CopyOnWriteBuffer& payload);
bool WriteDataChannelOpenMessage(const std::string& label,
const DataChannelInit& config,
- rtc::Buffer* payload);
+ rtc::CopyOnWriteBuffer* payload);
-void WriteDataChannelOpenAckMessage(rtc::Buffer* payload);
+void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload);
} // namespace webrtc
#endif // WEBRTC_API_SCTPUTILS_H_