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

Side by Side Diff: webrtc/p2p/base/pseudotcp.cc

Issue 1923163003: Replace scoped_ptr with unique_ptr in webrtc/p2p/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 | « webrtc/p2p/base/port_unittest.cc ('k') | webrtc/p2p/base/relayport_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/p2p/base/pseudotcp.h" 11 #include "webrtc/p2p/base/pseudotcp.h"
12 12
13 #include <stdio.h> 13 #include <stdio.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 15
16 #include <algorithm> 16 #include <algorithm>
17 #include <memory>
17 #include <set> 18 #include <set>
18 19
19 #include "webrtc/base/arraysize.h" 20 #include "webrtc/base/arraysize.h"
20 #include "webrtc/base/basictypes.h" 21 #include "webrtc/base/basictypes.h"
21 #include "webrtc/base/bytebuffer.h" 22 #include "webrtc/base/bytebuffer.h"
22 #include "webrtc/base/byteorder.h" 23 #include "webrtc/base/byteorder.h"
23 #include "webrtc/base/common.h" 24 #include "webrtc/base/common.h"
24 #include "webrtc/base/logging.h" 25 #include "webrtc/base/logging.h"
25 #include "webrtc/base/scoped_ptr.h"
26 #include "webrtc/base/socket.h" 26 #include "webrtc/base/socket.h"
27 #include "webrtc/base/stringutils.h" 27 #include "webrtc/base/stringutils.h"
28 #include "webrtc/base/timeutils.h" 28 #include "webrtc/base/timeutils.h"
29 29
30 // The following logging is for detailed (packet-level) analysis only. 30 // The following logging is for detailed (packet-level) analysis only.
31 #define _DBG_NONE 0 31 #define _DBG_NONE 0
32 #define _DBG_NORMAL 1 32 #define _DBG_NORMAL 1
33 #define _DBG_VERBOSE 2 33 #define _DBG_VERBOSE 2
34 #define _DEBUGMSG _DBG_NONE 34 #define _DEBUGMSG _DBG_NONE
35 35
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 511 }
512 512
513 IPseudoTcpNotify::WriteResult PseudoTcp::packet(uint32_t seq, 513 IPseudoTcpNotify::WriteResult PseudoTcp::packet(uint32_t seq,
514 uint8_t flags, 514 uint8_t flags,
515 uint32_t offset, 515 uint32_t offset,
516 uint32_t len) { 516 uint32_t len) {
517 ASSERT(HEADER_SIZE + len <= MAX_PACKET); 517 ASSERT(HEADER_SIZE + len <= MAX_PACKET);
518 518
519 uint32_t now = Now(); 519 uint32_t now = Now();
520 520
521 rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[MAX_PACKET]); 521 std::unique_ptr<uint8_t[]> buffer(new uint8_t[MAX_PACKET]);
522 long_to_bytes(m_conv, buffer.get()); 522 long_to_bytes(m_conv, buffer.get());
523 long_to_bytes(seq, buffer.get() + 4); 523 long_to_bytes(seq, buffer.get() + 4);
524 long_to_bytes(m_rcv_nxt, buffer.get() + 8); 524 long_to_bytes(m_rcv_nxt, buffer.get() + 8);
525 buffer[12] = 0; 525 buffer[12] = 0;
526 buffer[13] = flags; 526 buffer[13] = flags;
527 short_to_bytes(static_cast<uint16_t>(m_rcv_wnd >> m_rwnd_scale), 527 short_to_bytes(static_cast<uint16_t>(m_rcv_wnd >> m_rwnd_scale),
528 buffer.get() + 14); 528 buffer.get() + 14);
529 529
530 // Timestamp computations 530 // Timestamp computations
531 long_to_bytes(now, buffer.get() + 16); 531 long_to_bytes(now, buffer.get() + 16);
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 m_rbuf_len = new_size; 1274 m_rbuf_len = new_size;
1275 m_rwnd_scale = scale_factor; 1275 m_rwnd_scale = scale_factor;
1276 m_ssthresh = new_size; 1276 m_ssthresh = new_size;
1277 1277
1278 size_t available_space = 0; 1278 size_t available_space = 0;
1279 m_rbuf.GetWriteRemaining(&available_space); 1279 m_rbuf.GetWriteRemaining(&available_space);
1280 m_rcv_wnd = static_cast<uint32_t>(available_space); 1280 m_rcv_wnd = static_cast<uint32_t>(available_space);
1281 } 1281 }
1282 1282
1283 } // namespace cricket 1283 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port_unittest.cc ('k') | webrtc/p2p/base/relayport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698