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

Side by Side Diff: runtime/bin/sync_socket_linux.cc

Issue 2830273002: [dart:io][windows] Implements RawSynchronousSocket (Closed)
Patch Set: Fix test and statuses 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(HOST_OS_LINUX) 8 #if defined(HOST_OS_LINUX)
9 9
10 #include "bin/sync_socket.h" 10 #include "bin/sync_socket.h"
11 11
12 #include <errno.h> // NOLINT 12 #include <errno.h> // NOLINT
13 13
14 #include "bin/fdutils.h" 14 #include "bin/fdutils.h"
15 #include "bin/socket_base.h"
15 #include "platform/signal_blocker.h" 16 #include "platform/signal_blocker.h"
16 17
17 namespace dart { 18 namespace dart {
18 namespace bin { 19 namespace bin {
19 20
20 SynchronousSocket::SynchronousSocket(intptr_t fd) : fd_(fd) {} 21 SynchronousSocket::SynchronousSocket(intptr_t fd) : fd_(fd) {}
21 22
22 23
23 void SynchronousSocket::SetClosedFd() { 24 void SynchronousSocket::SetClosedFd() {
24 fd_ = kClosedFd; 25 fd_ = kClosedFd;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 57
57 intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) { 58 intptr_t SynchronousSocket::CreateConnect(const RawAddr& addr) {
58 intptr_t fd = Create(addr); 59 intptr_t fd = Create(addr);
59 if (fd < 0) { 60 if (fd < 0) {
60 return fd; 61 return fd;
61 } 62 }
62 return Connect(fd, addr); 63 return Connect(fd, addr);
63 } 64 }
64 65
65 66
67 intptr_t SynchronousSocket::Available(intptr_t fd) {
68 return SocketBase::Available(fd);
69 }
70
71
72 intptr_t SynchronousSocket::GetPort(intptr_t fd) {
73 return SocketBase::GetPort(fd);
74 }
75
76
77 SocketAddress* SynchronousSocket::GetRemotePeer(intptr_t fd, intptr_t* port) {
78 return SocketBase::GetRemotePeer(fd, port);
79 }
80
81
82 intptr_t SynchronousSocket::Read(intptr_t fd,
83 void* buffer,
84 intptr_t num_bytes) {
85 return SocketBase::Read(fd, buffer, num_bytes);
86 }
87
88
89 intptr_t SynchronousSocket::Write(intptr_t fd,
90 const void* buffer,
91 intptr_t num_bytes) {
92 return SocketBase::Write(fd, buffer, num_bytes);
93 }
94
95
66 void SynchronousSocket::ShutdownRead(intptr_t fd) { 96 void SynchronousSocket::ShutdownRead(intptr_t fd) {
67 VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_RD)); 97 VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_RD));
68 } 98 }
69 99
70 100
71 void SynchronousSocket::ShutdownWrite(intptr_t fd) { 101 void SynchronousSocket::ShutdownWrite(intptr_t fd) {
72 VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_WR)); 102 VOID_NO_RETRY_EXPECTED(shutdown(fd, SHUT_WR));
73 } 103 }
74 104
105
106 void SynchronousSocket::Close(intptr_t fd) {
107 return SocketBase::Close(fd);
108 }
109
75 } // namespace bin 110 } // namespace bin
76 } // namespace dart 111 } // namespace dart
77 112
78 #endif // defined(HOST_OS_LINUX) 113 #endif // defined(HOST_OS_LINUX)
79 114
80 #endif // !defined(DART_IO_DISABLED) 115 #endif // !defined(DART_IO_DISABLED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698