OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 BASE_SYNC_SOCKET_H_ | 5 #ifndef BASE_SYNC_SOCKET_H_ |
6 #define BASE_SYNC_SOCKET_H_ | 6 #define BASE_SYNC_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // A socket abstraction used for sending and receiving plain | 9 // A socket abstraction used for sending and receiving plain |
10 // data. Because they are blocking, they can be used to perform | 10 // data. Because they are blocking, they can be used to perform |
11 // rudimentary cross-process synchronization with low latency. | 11 // rudimentary cross-process synchronization with low latency. |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 #include <windows.h> | 15 #include <windows.h> |
16 #endif | 16 #endif |
17 #include <sys/types.h> | 17 #include <sys/types.h> |
18 | 18 |
| 19 #include "base/base_api.h" |
| 20 |
19 namespace base { | 21 namespace base { |
20 | 22 |
21 class SyncSocket { | 23 class BASE_API SyncSocket { |
22 public: | 24 public: |
23 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
24 typedef HANDLE Handle; | 26 typedef HANDLE Handle; |
25 #else | 27 #else |
26 typedef int Handle; | 28 typedef int Handle; |
27 #endif | 29 #endif |
28 | 30 |
29 // Creates a SyncSocket from a Handle. Used in transport. | 31 // Creates a SyncSocket from a Handle. Used in transport. |
30 explicit SyncSocket(Handle handle) : handle_(handle) { } | 32 explicit SyncSocket(Handle handle) : handle_(handle) { } |
31 ~SyncSocket() { Close(); } | 33 ~SyncSocket() { Close(); } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 66 |
65 private: | 67 private: |
66 Handle handle_; | 68 Handle handle_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(SyncSocket); | 70 DISALLOW_COPY_AND_ASSIGN(SyncSocket); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace base | 73 } // namespace base |
72 | 74 |
73 #endif // BASE_SYNC_SOCKET_H_ | 75 #endif // BASE_SYNC_SOCKET_H_ |
OLD | NEW |