OLD | NEW |
1 // Copyright (c) 2011 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" | 19 #include "base/base_export.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 | 22 |
23 class BASE_API SyncSocket { | 23 class BASE_EXPORT SyncSocket { |
24 public: | 24 public: |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 typedef HANDLE Handle; | 26 typedef HANDLE Handle; |
27 #else | 27 #else |
28 typedef int Handle; | 28 typedef int Handle; |
29 #endif | 29 #endif |
30 | 30 |
31 // Creates a SyncSocket from a Handle. Used in transport. | 31 // Creates a SyncSocket from a Handle. Used in transport. |
32 explicit SyncSocket(Handle handle) : handle_(handle) { } | 32 explicit SyncSocket(Handle handle) : handle_(handle) { } |
33 ~SyncSocket() { Close(); } | 33 ~SyncSocket() { Close(); } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 private: | 67 private: |
68 Handle handle_; | 68 Handle handle_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(SyncSocket); | 70 DISALLOW_COPY_AND_ASSIGN(SyncSocket); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace base | 73 } // namespace base |
74 | 74 |
75 #endif // BASE_SYNC_SOCKET_H_ | 75 #endif // BASE_SYNC_SOCKET_H_ |
OLD | NEW |