OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_NET_SOCKET_H_ | 5 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_NET_SOCKET_H_ |
6 #define PACKAGES_LIBRARIES_NACL_MOUNTS_NET_SOCKET_H_ | 6 #define PACKAGES_LIBRARIES_NACL_MOUNTS_NET_SOCKET_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "../net/Socket.h" | 12 #include "../net/Socket.h" |
13 #include "../net/SocketSubSystem.h" | 13 #include "../net/SocketSubSystem.h" |
14 #include "ppapi/cpp/completion_callback.h" | 14 #include "ppapi/cpp/completion_callback.h" |
15 #include "ppapi/utility/non_thread_safe_ref_count.h" | |
jvoung - send to chromium...
2012/08/21 16:37:28
What I meant was that this header doesn't exist an
| |
15 #include "../ppapi/cpp/private/tcp_socket_private.h" | 16 #include "../ppapi/cpp/private/tcp_socket_private.h" |
16 #include "../util/PthreadHelpers.h" | 17 #include "../util/PthreadHelpers.h" |
17 | 18 |
18 class TCPSocket : public Socket { | 19 class TCPSocket : public Socket { |
19 public: | 20 public: |
20 TCPSocket(SocketSubSystem* sys, int oflag); | 21 TCPSocket(SocketSubSystem* sys, int oflag); |
21 virtual ~TCPSocket(); | 22 virtual ~TCPSocket(); |
22 | 23 |
23 int oflag() { return oflag_; } | 24 int oflag() { return oflag_; } |
24 bool is_block() { return !(oflag_ & O_NONBLOCK); } | 25 bool is_block() { return !(oflag_ & O_NONBLOCK); } |
(...skipping 29 matching lines...) Expand all Loading... | |
54 | 55 |
55 void Close(int32_t result, int32_t* pres); | 56 void Close(int32_t result, int32_t* pres); |
56 | 57 |
57 bool Accept(int32_t result, PP_Resource resource, int32_t* pres); | 58 bool Accept(int32_t result, PP_Resource resource, int32_t* pres); |
58 | 59 |
59 static const size_t kBufSize = 64 * 1024; | 60 static const size_t kBufSize = 64 * 1024; |
60 | 61 |
61 SocketSubSystem* sys_; | 62 SocketSubSystem* sys_; |
62 int ref_; | 63 int ref_; |
63 int oflag_; | 64 int oflag_; |
64 pp::CompletionCallbackFactory<TCPSocket, ThreadSafeRefCount> factory_; | 65 pp::CompletionCallbackFactory<TCPSocket, pp::NonThreadSafeRefCount> factory_; |
65 pp::TCPSocketPrivate* socket_; | 66 pp::TCPSocketPrivate* socket_; |
66 std::deque<char> in_buf_; | 67 std::deque<char> in_buf_; |
67 std::vector<char> out_buf_; | 68 std::vector<char> out_buf_; |
68 std::vector<char> read_buf_; | 69 std::vector<char> read_buf_; |
69 std::vector<char> write_buf_; | 70 std::vector<char> write_buf_; |
70 bool write_sent_; | 71 bool write_sent_; |
71 | 72 |
72 DISALLOW_COPY_AND_ASSIGN(TCPSocket); | 73 DISALLOW_COPY_AND_ASSIGN(TCPSocket); |
73 }; | 74 }; |
74 | 75 |
75 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_NET_SOCKET_H_ | 76 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_NET_SOCKET_H_ |
76 | 77 |
OLD | NEW |