| 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; |
| 11 #else | 11 #else |
| 12 #include <stdint.h> | 12 #include <stdint.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 #include <string.h> | 16 #include <string.h> |
| 17 #include <stdio.h> | 17 #include <stdio.h> |
| 18 #include <sys/types.h> | 18 #include <sys/types.h> |
| 19 | 19 |
| 20 #include "bin/builtin.h" |
| 21 #include "bin/dartutils.h" |
| 22 #include "platform/globals.h" |
| 23 #include "platform/thread.h" |
| 24 |
| 20 // Forward declaration. | 25 // Forward declaration. |
| 21 class FileHandle; | 26 class FileHandle; |
| 22 | 27 |
| 23 class File { | 28 class File { |
| 24 public: | 29 public: |
| 25 enum FileOpenMode { | 30 enum FileOpenMode { |
| 26 kRead = 0, | 31 kRead = 0, |
| 27 kWrite = 1, | 32 kWrite = 1, |
| 28 kTruncate = 1 << 2, | 33 kTruncate = 1 << 2, |
| 29 kWriteTruncate = kWrite | kTruncate | 34 kWriteTruncate = kWrite | kTruncate |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 static bool Delete(const char* name); | 121 static bool Delete(const char* name); |
| 117 static bool IsAbsolutePath(const char* pathname); | 122 static bool IsAbsolutePath(const char* pathname); |
| 118 static char* GetCanonicalPath(const char* name); | 123 static char* GetCanonicalPath(const char* name); |
| 119 static char* GetContainingDirectory(char* name); | 124 static char* GetContainingDirectory(char* name); |
| 120 static const char* PathSeparator(); | 125 static const char* PathSeparator(); |
| 121 static const char* StringEscapedPathSeparator(); | 126 static const char* StringEscapedPathSeparator(); |
| 122 static StdioHandleType GetStdioHandleType(int fd); | 127 static StdioHandleType GetStdioHandleType(int fd); |
| 123 | 128 |
| 124 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); | 129 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); |
| 125 | 130 |
| 131 static Dart_Port GetServicePort(); |
| 132 |
| 126 private: | 133 private: |
| 127 File(const char* name, FileHandle* handle) : name_(name), handle_(handle) { } | 134 File(const char* name, FileHandle* handle) : name_(name), handle_(handle) { } |
| 128 void Close(); | 135 void Close(); |
| 129 bool IsClosed(); | 136 bool IsClosed(); |
| 130 | 137 |
| 131 static const int kClosedFd = -1; | 138 static const int kClosedFd = -1; |
| 132 | 139 |
| 133 const char* name_; | 140 const char* name_; |
| 134 // FileHandle is an OS specific class which stores data about the file. | 141 // FileHandle is an OS specific class which stores data about the file. |
| 135 FileHandle* handle_; // OS specific handle for the file. | 142 FileHandle* handle_; // OS specific handle for the file. |
| 136 | 143 |
| 137 // DISALLOW_COPY_AND_ASSIGN(File). | 144 // DISALLOW_COPY_AND_ASSIGN(File). |
| 138 File(const File&); | 145 File(const File&); |
| 139 void operator=(const File&); | 146 void operator=(const File&); |
| 147 |
| 148 static dart::Mutex mutex_; |
| 149 static int service_ports_size_; |
| 150 static Dart_Port* service_ports_; |
| 151 static int service_ports_index_; |
| 140 }; | 152 }; |
| 141 | 153 |
| 142 #endif // BIN_FILE_H_ | 154 #endif // BIN_FILE_H_ |
| OLD | NEW |