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

Side by Side Diff: runtime/bin/sync_socket.h

Issue 2803543006: Added synchronous socket implementation to dart:io. (Closed)
Patch Set: Small fix for MacOS 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
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
zra 2017/04/07 05:29:28 2017
bkonyi 2017/04/10 19:20:05 Done.
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.
4
5 #ifndef RUNTIME_BIN_SYNC_SOCKET_H_
6 #define RUNTIME_BIN_SYNC_SOCKET_H_
7
8 #if defined(DART_IO_DISABLED)
9 #error "sync_socket.h can only be included on builds with IO enabled"
10 #endif
11
12 #include "platform/globals.h"
13
14 #include "bin/builtin.h"
zra 2017/04/07 05:29:28 It looks like some of these includes are probably
bkonyi 2017/04/10 19:20:05 Done.
15 #include "bin/dartutils.h"
16 #include "bin/socket_base.h"
17 #include "bin/thread.h"
18 #include "bin/utils.h"
19 #include "platform/hashmap.h"
20
21 namespace dart {
22 namespace bin {
23
24 class SynchronousSocket {
25 public:
26 explicit SynchronousSocket(intptr_t fd);
27
28 intptr_t fd() const { return fd_; }
29 void SetClosedFd();
30
31 static bool Initialize();
32
33 static intptr_t CreateConnect(const RawAddr& addr);
34
35 static void SetSocketIdNativeField(Dart_Handle handle, intptr_t id);
36 static void ReuseSocketIdNativeField(Dart_Handle handle,
zra 2017/04/07 05:29:28 The native wrapper instances won't be reused, so t
bkonyi 2017/04/10 19:20:05 Done.
37 SynchronousSocket* socket);
38 static SynchronousSocket* GetSocketIdNativeField(Dart_Handle socket);
39
40 static void ShutdownRead(intptr_t fd);
41 static void ShutdownWrite(intptr_t fd);
42
43 private:
44 ~SynchronousSocket() { ASSERT(fd_ == kClosedFd); }
zra 2017/04/07 05:29:28 This should be public since SynchronousSocket isn'
bkonyi 2017/04/10 19:20:05 Done.
45
46 static const int kClosedFd = -1;
47
48 intptr_t fd_;
49 Dart_Port port_;
zra 2017/04/07 05:29:28 I think this field isn't needed.
bkonyi 2017/04/10 19:20:05 You're right. Removed.
50
51 DISALLOW_COPY_AND_ASSIGN(SynchronousSocket);
52 };
53
54 } // namespace bin
55 } // namespace dart
56
57 #endif // RUNTIME_BIN_SYNC_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698