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

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

Issue 296403005: Show actualy FD for files in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2js patch function. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_android.cc » ('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 #include "bin/file.h" 5 #include "bin/file.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 #include "bin/io_buffer.h" 9 #include "bin/io_buffer.h"
10 #include "bin/thread.h" 10 #include "bin/thread.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 105
106 void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { 106 void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) {
107 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); 107 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
108 ASSERT(file != NULL); 108 ASSERT(file != NULL);
109 delete file; 109 delete file;
110 Dart_SetReturnValue(args, Dart_NewInteger(0)); 110 Dart_SetReturnValue(args, Dart_NewInteger(0));
111 } 111 }
112 112
113 113
114 void FUNCTION_NAME(File_GetFD)(Dart_NativeArguments args) {
115 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
116 ASSERT(file != NULL);
117 Dart_SetReturnValue(args, Dart_NewInteger(file->GetFD()));
118 }
119
120
114 void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) { 121 void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) {
115 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); 122 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
116 ASSERT(file != NULL); 123 ASSERT(file != NULL);
117 uint8_t buffer; 124 uint8_t buffer;
118 int64_t bytes_read = file->Read(reinterpret_cast<void*>(&buffer), 1); 125 int64_t bytes_read = file->Read(reinterpret_cast<void*>(&buffer), 1);
119 if (bytes_read == 1) { 126 if (bytes_read == 1) {
120 Dart_SetReturnValue(args, Dart_NewInteger(buffer)); 127 Dart_SetReturnValue(args, Dart_NewInteger(buffer));
121 } else if (bytes_read == 0) { 128 } else if (bytes_read == 0) {
122 Dart_SetReturnValue(args, Dart_NewInteger(-1)); 129 Dart_SetReturnValue(args, Dart_NewInteger(-1));
123 } else { 130 } else {
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 CObjectArray* wrapper = new CObjectArray(CObject::NewArray(2)); 1192 CObjectArray* wrapper = new CObjectArray(CObject::NewArray(2));
1186 wrapper->SetAt(0, new CObjectInt32(CObject::NewInt32(CObject::kSuccess))); 1193 wrapper->SetAt(0, new CObjectInt32(CObject::NewInt32(CObject::kSuccess)));
1187 wrapper->SetAt(1, result); 1194 wrapper->SetAt(1, result);
1188 return wrapper; 1195 return wrapper;
1189 } 1196 }
1190 return CObject::IllegalArgumentError(); 1197 return CObject::IllegalArgumentError();
1191 } 1198 }
1192 1199
1193 } // namespace bin 1200 } // namespace bin
1194 } // namespace dart 1201 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698