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

Side by Side Diff: remoting/protocol/socket_wrapper.cc

Issue 7289032: Remove SocketWrapper to expose the threading issues it masks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase once more. Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/socket_wrapper.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/protocol/socket_wrapper.h"
6
7 #include "base/logging.h"
8 #include "net/base/net_errors.h"
9
10 namespace remoting {
11 namespace protocol {
12
13 SocketWrapper::SocketWrapper(net::Socket* socket)
14 : socket_(socket) {
15 }
16
17 SocketWrapper::~SocketWrapper() {
18 DCHECK(!socket_.get());
19 }
20
21 int SocketWrapper::Read(net::IOBuffer* buf, int buf_len,
22 net::CompletionCallback* callback) {
23 if (!socket_.get())
24 return net::ERR_SOCKET_NOT_CONNECTED;
25 return socket_->Read(buf, buf_len, callback);
26 }
27
28 int SocketWrapper::Write(net::IOBuffer* buf, int buf_len,
29 net::CompletionCallback* callback) {
30 if (!socket_.get())
31 return net::ERR_SOCKET_NOT_CONNECTED;
32 return socket_->Write(buf, buf_len, callback);
33 }
34
35 bool SocketWrapper::SetReceiveBufferSize(int32 size) {
36 if (!socket_.get())
37 return false;
38 return socket_->SetReceiveBufferSize(size);
39 }
40
41 bool SocketWrapper::SetSendBufferSize(int32 size) {
42 if (!socket_.get())
43 return false;
44 return socket_->SetSendBufferSize(size);
45 }
46
47 void SocketWrapper::Disconnect() {
48 socket_.reset();
49 }
50
51 } // namespace protocol
52 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/socket_wrapper.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698