Index: runtime/bin/sync_socket.h |
diff --git a/runtime/bin/sync_socket.h b/runtime/bin/sync_socket.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..aa0ec0bb5febbfa275f40eaa12bd03885849fdcb |
--- /dev/null |
+++ b/runtime/bin/sync_socket.h |
@@ -0,0 +1,47 @@ |
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#ifndef RUNTIME_BIN_SYNC_SOCKET_H_ |
+#define RUNTIME_BIN_SYNC_SOCKET_H_ |
+ |
+#if defined(DART_IO_DISABLED) |
+#error "sync_socket.h can only be included on builds with IO enabled" |
+#endif |
siva
2017/04/11 23:04:47
The socket* files seem to use
#if !defined(DART_IO
bkonyi
2017/04/12 18:21:09
That pattern is only used in the socket*.cc files,
|
+ |
+#include "bin/socket_base.h" |
+#include "platform/globals.h" |
+ |
+namespace dart { |
+namespace bin { |
+ |
+class SynchronousSocket { |
+ public: |
+ explicit SynchronousSocket(intptr_t fd); |
+ ~SynchronousSocket() { ASSERT(fd_ == kClosedFd); } |
+ |
+ intptr_t fd() const { return fd_; } |
+ void SetClosedFd(); |
+ |
+ static bool Initialize(); |
+ |
+ static intptr_t CreateConnect(const RawAddr& addr); |
+ |
+ static void SetSocketIdNativeField(Dart_Handle handle, intptr_t id); |
+ static SynchronousSocket* GetSocketIdNativeField(Dart_Handle socket); |
siva
2017/04/11 23:04:47
The get/set API is not uniform
set takes an intptr
bkonyi
2017/04/12 18:21:09
Done.
|
+ |
+ static void ShutdownRead(intptr_t fd); |
+ static void ShutdownWrite(intptr_t fd); |
+ |
+ private: |
+ static const int kClosedFd = -1; |
+ |
+ intptr_t fd_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SynchronousSocket); |
+}; |
+ |
+} // namespace bin |
+} // namespace dart |
+ |
+#endif // RUNTIME_BIN_SYNC_SOCKET_H_ |