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

Side by Side Diff: webrtc/base/asynctcpsocket.h

Issue 1744293002: Lazily allocate input buffer for AsyncTCPSocket. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updated TODOs 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/asynctcpsocket.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
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 private: 66 private:
67 // Called by the underlying socket 67 // Called by the underlying socket
68 void OnConnectEvent(AsyncSocket* socket); 68 void OnConnectEvent(AsyncSocket* socket);
69 void OnReadEvent(AsyncSocket* socket); 69 void OnReadEvent(AsyncSocket* socket);
70 void OnWriteEvent(AsyncSocket* socket); 70 void OnWriteEvent(AsyncSocket* socket);
71 void OnCloseEvent(AsyncSocket* socket, int error); 71 void OnCloseEvent(AsyncSocket* socket, int error);
72 72
73 scoped_ptr<AsyncSocket> socket_; 73 scoped_ptr<AsyncSocket> socket_;
74 bool listen_; 74 bool listen_;
75 scoped_ptr<char[]> inbuf_; 75 Buffer inbuf_;
76 Buffer outbuf_; 76 Buffer outbuf_;
77 size_t insize_, inpos_; 77 size_t max_insize_;
78 size_t max_outsize_; 78 size_t max_outsize_;
79 79
80 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocketBase); 80 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocketBase);
81 }; 81 };
82 82
83 class AsyncTCPSocket : public AsyncTCPSocketBase { 83 class AsyncTCPSocket : public AsyncTCPSocketBase {
84 public: 84 public:
85 // Binds and connects |socket| and creates AsyncTCPSocket for 85 // Binds and connects |socket| and creates AsyncTCPSocket for
86 // it. Takes ownership of |socket|. Returns NULL if bind() or 86 // it. Takes ownership of |socket|. Returns NULL if bind() or
87 // connect() fail (|socket| is destroyed in that case). 87 // connect() fail (|socket| is destroyed in that case).
88 static AsyncTCPSocket* Create(AsyncSocket* socket, 88 static AsyncTCPSocket* Create(AsyncSocket* socket,
89 const SocketAddress& bind_address, 89 const SocketAddress& bind_address,
90 const SocketAddress& remote_address); 90 const SocketAddress& remote_address);
91 AsyncTCPSocket(AsyncSocket* socket, bool listen); 91 AsyncTCPSocket(AsyncSocket* socket, bool listen);
92 ~AsyncTCPSocket() override {} 92 ~AsyncTCPSocket() override {}
93 93
94 int Send(const void* pv, 94 int Send(const void* pv,
95 size_t cb, 95 size_t cb,
96 const rtc::PacketOptions& options) override; 96 const rtc::PacketOptions& options) override;
97 void ProcessInput(char* data, size_t* len) override; 97 void ProcessInput(char* data, size_t* len) override;
98 void HandleIncomingConnection(AsyncSocket* socket) override; 98 void HandleIncomingConnection(AsyncSocket* socket) override;
99 99
100 private: 100 private:
101 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocket); 101 RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocket);
102 }; 102 };
103 103
104 } // namespace rtc 104 } // namespace rtc
105 105
106 #endif // WEBRTC_BASE_ASYNCTCPSOCKET_H_ 106 #endif // WEBRTC_BASE_ASYNCTCPSOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/asynctcpsocket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698