| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef BIN_FILE_H_ | 5 #ifndef BIN_FILE_H_ |
| 6 #define BIN_FILE_H_ | 6 #define BIN_FILE_H_ |
| 7 | 7 |
| 8 #if defined(_WIN32) | 8 #if defined(_WIN32) |
| 9 typedef signed __int64 int64_t; | 9 typedef signed __int64 int64_t; |
| 10 typedef unsigned __int8 uint8_t; | 10 typedef unsigned __int8 uint8_t; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 kCreateRequest = 1, | 55 kCreateRequest = 1, |
| 56 kDeleteRequest = 2, | 56 kDeleteRequest = 2, |
| 57 kOpenRequest = 3, | 57 kOpenRequest = 3, |
| 58 kFullPathRequest = 4, | 58 kFullPathRequest = 4, |
| 59 kDirectoryRequest = 5, | 59 kDirectoryRequest = 5, |
| 60 kCloseRequest = 6, | 60 kCloseRequest = 6, |
| 61 kPositionRequest = 7, | 61 kPositionRequest = 7, |
| 62 kSetPositionRequest = 8, | 62 kSetPositionRequest = 8, |
| 63 kTruncateRequest = 9, | 63 kTruncateRequest = 9, |
| 64 kLengthRequest = 10, | 64 kLengthRequest = 10, |
| 65 kFlushRequest = 11, | 65 kLengthFromNameRequest = 11, |
| 66 kReadByteRequest = 12, | 66 kFlushRequest = 12, |
| 67 kWriteByteRequest = 13, | 67 kReadByteRequest = 13, |
| 68 kReadListRequest = 14, | 68 kWriteByteRequest = 14, |
| 69 kWriteListRequest = 15, | 69 kReadListRequest = 15, |
| 70 kWriteStringRequest = 16 | 70 kWriteListRequest = 16, |
| 71 kWriteStringRequest = 17 |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 ~File(); | 74 ~File(); |
| 74 | 75 |
| 75 // Read/Write attempt to transfer num_bytes to/from buffer. It returns | 76 // Read/Write attempt to transfer num_bytes to/from buffer. It returns |
| 76 // the number of bytes read/written. | 77 // the number of bytes read/written. |
| 77 int64_t Read(void* buffer, int64_t num_bytes); | 78 int64_t Read(void* buffer, int64_t num_bytes); |
| 78 int64_t Write(const void* buffer, int64_t num_bytes); | 79 int64_t Write(const void* buffer, int64_t num_bytes); |
| 79 | 80 |
| 80 // ReadFully and WriteFully do attempt to transfer num_bytes to/from | 81 // ReadFully and WriteFully do attempt to transfer num_bytes to/from |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // mode contains kTruncate. | 117 // mode contains kTruncate. |
| 117 static File* Open(const char* name, FileOpenMode mode); | 118 static File* Open(const char* name, FileOpenMode mode); |
| 118 | 119 |
| 119 // Create a file object for the specified stdio file descriptor | 120 // Create a file object for the specified stdio file descriptor |
| 120 // (stdin, stout or stderr). | 121 // (stdin, stout or stderr). |
| 121 static File* OpenStdio(int fd); | 122 static File* OpenStdio(int fd); |
| 122 | 123 |
| 123 static bool Exists(const char* name); | 124 static bool Exists(const char* name); |
| 124 static bool Create(const char* name); | 125 static bool Create(const char* name); |
| 125 static bool Delete(const char* name); | 126 static bool Delete(const char* name); |
| 127 static off_t LengthFromName(const char* name); |
| 126 static bool IsAbsolutePath(const char* pathname); | 128 static bool IsAbsolutePath(const char* pathname); |
| 127 static char* GetCanonicalPath(const char* name); | 129 static char* GetCanonicalPath(const char* name); |
| 128 static char* GetContainingDirectory(char* name); | 130 static char* GetContainingDirectory(char* name); |
| 129 static const char* PathSeparator(); | 131 static const char* PathSeparator(); |
| 130 static const char* StringEscapedPathSeparator(); | 132 static const char* StringEscapedPathSeparator(); |
| 131 static StdioHandleType GetStdioHandleType(int fd); | 133 static StdioHandleType GetStdioHandleType(int fd); |
| 132 | 134 |
| 133 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); | 135 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); |
| 134 | 136 |
| 135 static Dart_Port GetServicePort(); | 137 static Dart_Port GetServicePort(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 148 File(const File&); | 150 File(const File&); |
| 149 void operator=(const File&); | 151 void operator=(const File&); |
| 150 | 152 |
| 151 static dart::Mutex mutex_; | 153 static dart::Mutex mutex_; |
| 152 static int service_ports_size_; | 154 static int service_ports_size_; |
| 153 static Dart_Port* service_ports_; | 155 static Dart_Port* service_ports_; |
| 154 static int service_ports_index_; | 156 static int service_ports_index_; |
| 155 }; | 157 }; |
| 156 | 158 |
| 157 #endif // BIN_FILE_H_ | 159 #endif // BIN_FILE_H_ |
| OLD | NEW |