| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 @end | 146 @end |
| 147 | 147 |
| 148 @implementation RTCDataBuffer { | 148 @implementation RTCDataBuffer { |
| 149 rtc::scoped_ptr<webrtc::DataBuffer> _dataBuffer; | 149 rtc::scoped_ptr<webrtc::DataBuffer> _dataBuffer; |
| 150 } | 150 } |
| 151 | 151 |
| 152 - (instancetype)initWithData:(NSData*)data isBinary:(BOOL)isBinary { | 152 - (instancetype)initWithData:(NSData*)data isBinary:(BOOL)isBinary { |
| 153 NSAssert(data, @"data cannot be nil"); | 153 NSAssert(data, @"data cannot be nil"); |
| 154 if (self = [super init]) { | 154 if (self = [super init]) { |
| 155 rtc::Buffer buffer(reinterpret_cast<const uint8_t*>([data bytes]), | 155 rtc::CopyOnWriteBuffer buffer( |
| 156 [data length]); | 156 reinterpret_cast<const uint8_t*>([data bytes]), [data length]); |
| 157 _dataBuffer.reset(new webrtc::DataBuffer(buffer, isBinary)); | 157 _dataBuffer.reset(new webrtc::DataBuffer(buffer, isBinary)); |
| 158 } | 158 } |
| 159 return self; | 159 return self; |
| 160 } | 160 } |
| 161 | 161 |
| 162 - (NSData*)data { | 162 - (NSData*)data { |
| 163 return [NSData dataWithBytes:_dataBuffer->data.data() | 163 return [NSData dataWithBytes:_dataBuffer->data.data() |
| 164 length:_dataBuffer->data.size()]; | 164 length:_dataBuffer->data.size()]; |
| 165 } | 165 } |
| 166 | 166 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 _observer.reset(new webrtc::RTCDataChannelObserver(self)); | 282 _observer.reset(new webrtc::RTCDataChannelObserver(self)); |
| 283 } | 283 } |
| 284 return self; | 284 return self; |
| 285 } | 285 } |
| 286 | 286 |
| 287 - (rtc::scoped_refptr<webrtc::DataChannelInterface>)dataChannel { | 287 - (rtc::scoped_refptr<webrtc::DataChannelInterface>)dataChannel { |
| 288 return _dataChannel; | 288 return _dataChannel; |
| 289 } | 289 } |
| 290 | 290 |
| 291 @end | 291 @end |
| OLD | NEW |