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

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

Issue 2830273002: [dart:io][windows] Implements RawSynchronousSocket (Closed)
Patch Set: Fix Linux build 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
« no previous file with comments | « runtime/bin/socket_base_macos.cc ('k') | runtime/bin/sync_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_WINDOWS) 8 #if defined(HOST_OS_WINDOWS)
9 9
10 #include "bin/socket_base.h" 10 #include "bin/socket_base.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return WSAAddressToStringA(&raw.addr, salen, NULL, address, &l) != 0; 69 return WSAAddressToStringA(&raw.addr, salen, NULL, address, &l) != 0;
70 } 70 }
71 71
72 72
73 intptr_t SocketBase::Available(intptr_t fd) { 73 intptr_t SocketBase::Available(intptr_t fd) {
74 ClientSocket* client_socket = reinterpret_cast<ClientSocket*>(fd); 74 ClientSocket* client_socket = reinterpret_cast<ClientSocket*>(fd);
75 return client_socket->Available(); 75 return client_socket->Available();
76 } 76 }
77 77
78 78
79 intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { 79 intptr_t SocketBase::Read(intptr_t fd,
80 void* buffer,
81 intptr_t num_bytes,
82 SocketOpKind sync) {
80 Handle* handle = reinterpret_cast<Handle*>(fd); 83 Handle* handle = reinterpret_cast<Handle*>(fd);
81 return handle->Read(buffer, num_bytes); 84 return handle->Read(buffer, num_bytes);
82 } 85 }
83 86
84 87
85 intptr_t SocketBase::RecvFrom(intptr_t fd, 88 intptr_t SocketBase::RecvFrom(intptr_t fd,
86 void* buffer, 89 void* buffer,
87 intptr_t num_bytes, 90 intptr_t num_bytes,
88 RawAddr* addr) { 91 RawAddr* addr,
92 SocketOpKind sync) {
89 Handle* handle = reinterpret_cast<Handle*>(fd); 93 Handle* handle = reinterpret_cast<Handle*>(fd);
90 socklen_t addr_len = sizeof(addr->ss); 94 socklen_t addr_len = sizeof(addr->ss);
91 return handle->RecvFrom(buffer, num_bytes, &addr->addr, addr_len); 95 return handle->RecvFrom(buffer, num_bytes, &addr->addr, addr_len);
92 } 96 }
93 97
94 98
95 intptr_t SocketBase::Write(intptr_t fd, 99 intptr_t SocketBase::Write(intptr_t fd,
96 const void* buffer, 100 const void* buffer,
97 intptr_t num_bytes) { 101 intptr_t num_bytes,
102 SocketOpKind sync) {
98 Handle* handle = reinterpret_cast<Handle*>(fd); 103 Handle* handle = reinterpret_cast<Handle*>(fd);
99 return handle->Write(buffer, num_bytes); 104 return handle->Write(buffer, num_bytes);
100 } 105 }
101 106
102 107
103 intptr_t SocketBase::SendTo(intptr_t fd, 108 intptr_t SocketBase::SendTo(intptr_t fd,
104 const void* buffer, 109 const void* buffer,
105 intptr_t num_bytes, 110 intptr_t num_bytes,
106 const RawAddr& addr) { 111 const RawAddr& addr,
112 SocketOpKind sync) {
107 Handle* handle = reinterpret_cast<Handle*>(fd); 113 Handle* handle = reinterpret_cast<Handle*>(fd);
108 RawAddr& raw = const_cast<RawAddr&>(addr); 114 RawAddr& raw = const_cast<RawAddr&>(addr);
109 return handle->SendTo(buffer, num_bytes, &raw.addr, 115 return handle->SendTo(buffer, num_bytes, &raw.addr,
110 SocketAddress::GetAddrLength(addr)); 116 SocketAddress::GetAddrLength(addr));
111 } 117 }
112 118
113 119
114 intptr_t SocketBase::GetPort(intptr_t fd) { 120 intptr_t SocketBase::GetPort(intptr_t fd) {
115 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket()); 121 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket());
116 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd); 122 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd);
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 return setsockopt(handle->socket(), proto, MCAST_LEAVE_GROUP, 452 return setsockopt(handle->socket(), proto, MCAST_LEAVE_GROUP,
447 reinterpret_cast<char*>(&mreq), sizeof(mreq)) == 0; 453 reinterpret_cast<char*>(&mreq), sizeof(mreq)) == 0;
448 } 454 }
449 455
450 } // namespace bin 456 } // namespace bin
451 } // namespace dart 457 } // namespace dart
452 458
453 #endif // defined(HOST_OS_WINDOWS) 459 #endif // defined(HOST_OS_WINDOWS)
454 460
455 #endif // !defined(DART_IO_DISABLED) 461 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/socket_base_macos.cc ('k') | runtime/bin/sync_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698