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

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

Issue 109803002: Profiler Take 2 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « no previous file | runtime/bin/file_android.cc » ('j') | runtime/bin/file_android.cc » ('J')
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"
11 #include "bin/utils.h" 11 #include "bin/utils.h"
12 12
13 #include "include/dart_api.h" 13 #include "include/dart_api.h"
14 #include "include/dart_native_api.h"
siva 2013/12/13 21:29:14 Leftover from a previous version? Not needed anymo
14 15
15 namespace dart { 16 namespace dart {
16 namespace bin { 17 namespace bin {
17 18
18 static const int kMSPerSecond = 1000; 19 static const int kMSPerSecond = 1000;
19 20
20 21
21 // The file pointer has been passed into Dart as an intptr_t and it is safe 22 // The file pointer has been passed into Dart as an intptr_t and it is safe
22 // to pull it out of Dart as a 64-bit integer, cast it to an intptr_t and 23 // to pull it out of Dart as a 64-bit integer, cast it to an intptr_t and
23 // from there to a File pointer. 24 // from there to a File pointer.
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 Dart_Handle result = 256 Dart_Handle result =
256 Dart_TypedDataAcquireData(buffer_obj, &type, &buffer, &buffer_len); 257 Dart_TypedDataAcquireData(buffer_obj, &type, &buffer, &buffer_len);
257 if (Dart_IsError(result)) Dart_PropagateError(result); 258 if (Dart_IsError(result)) Dart_PropagateError(result);
258 259
259 ASSERT(type == Dart_TypedData_kUint8 || type == Dart_TypedData_kInt8); 260 ASSERT(type == Dart_TypedData_kUint8 || type == Dart_TypedData_kInt8);
260 ASSERT(end <= buffer_len); 261 ASSERT(end <= buffer_len);
261 ASSERT(buffer != NULL); 262 ASSERT(buffer != NULL);
262 263
263 // Write the data out into the file. 264 // Write the data out into the file.
264 int64_t bytes_written = file->Write(reinterpret_cast<void*>(buffer), length); 265 int64_t bytes_written = file->Write(reinterpret_cast<void*>(buffer), length);
265
266 // Release the direct pointer acquired above. 266 // Release the direct pointer acquired above.
267 result = Dart_TypedDataReleaseData(buffer_obj); 267 result = Dart_TypedDataReleaseData(buffer_obj);
268 if (Dart_IsError(result)) Dart_PropagateError(result); 268 if (Dart_IsError(result)) Dart_PropagateError(result);
269 269
270 if (bytes_written != length) { 270 if (bytes_written != length) {
271 Dart_Handle err = DartUtils::NewDartOSError(); 271 Dart_Handle err = DartUtils::NewDartOSError();
272 if (Dart_IsError(err)) Dart_PropagateError(err); 272 if (Dart_IsError(err)) Dart_PropagateError(err);
273 Dart_SetReturnValue(args, err); 273 Dart_SetReturnValue(args, err);
274 } 274 }
275 } 275 }
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 CObjectArray* wrapper = new CObjectArray(CObject::NewArray(2)); 1186 CObjectArray* wrapper = new CObjectArray(CObject::NewArray(2));
1187 wrapper->SetAt(0, new CObjectInt32(CObject::NewInt32(CObject::kSuccess))); 1187 wrapper->SetAt(0, new CObjectInt32(CObject::NewInt32(CObject::kSuccess)));
1188 wrapper->SetAt(1, result); 1188 wrapper->SetAt(1, result);
1189 return wrapper; 1189 return wrapper;
1190 } 1190 }
1191 return CObject::IllegalArgumentError(); 1191 return CObject::IllegalArgumentError();
1192 } 1192 }
1193 1193
1194 } // namespace bin 1194 } // namespace bin
1195 } // namespace dart 1195 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/file_android.cc » ('j') | runtime/bin/file_android.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698