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

Unified Diff: runtime/bin/sync_socket.h

Issue 2803543006: Added synchronous socket implementation to dart:io. (Closed)
Patch Set: Changed signature for GetSocketIdNativeField Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | runtime/bin/sync_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4a918365aa79548c4d769668485a86064e3f6627
--- /dev/null
+++ b/runtime/bin/sync_socket.h
@@ -0,0 +1,48 @@
+// 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
+
+#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 Dart_Handle SetSocketIdNativeField(Dart_Handle handle, intptr_t id);
+ static Dart_Handle GetSocketIdNativeField(Dart_Handle socket_obj,
+ SynchronousSocket** socket);
+
+ 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_
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | runtime/bin/sync_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698