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

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

Issue 9773037: Make the temporary OSError allocation method private. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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/common.dart ('k') | no next file » | 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) 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 #include "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "bin/file.h" 7 #include "bin/file.h"
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/globals.h" 10 #include "platform/globals.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return NewDartOSError(&os_error); 284 return NewDartOSError(&os_error);
285 } 285 }
286 286
287 287
288 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) { 288 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) {
289 // Create a Dart OSError object with the information retrieved from the OS. 289 // Create a Dart OSError object with the information retrieved from the OS.
290 Dart_Handle url = Dart_NewString("dart:io"); 290 Dart_Handle url = Dart_NewString("dart:io");
291 if (Dart_IsError(url)) return url; 291 if (Dart_IsError(url)) return url;
292 Dart_Handle lib = Dart_LookupLibrary(url); 292 Dart_Handle lib = Dart_LookupLibrary(url);
293 if (Dart_IsError(lib)) return lib; 293 if (Dart_IsError(lib)) return lib;
294 Dart_Handle cls = Dart_NewString("IOUtils"); 294 Dart_Handle function_name = Dart_NewString("_makeOSError");
295 if (Dart_IsError(cls)) return cls; 295 if (Dart_IsError(function_name)) return function_name;
296 Dart_Handle method = Dart_NewString("makeOSError");
297 if (Dart_IsError(method)) return method;
298 Dart_Handle args[2]; 296 Dart_Handle args[2];
299 args[0] = Dart_NewString(os_error->message()); 297 args[0] = Dart_NewString(os_error->message());
300 if (Dart_IsError(args[0])) return args[0]; 298 if (Dart_IsError(args[0])) return args[0];
301 args[1] = Dart_NewInteger(os_error->code()); 299 args[1] = Dart_NewInteger(os_error->code());
302 if (Dart_IsError(args[1])) return args[1]; 300 if (Dart_IsError(args[1])) return args[1];
303 Dart_Handle err = Dart_InvokeStatic(lib, cls, method, 2, args); 301 Dart_Handle err = Dart_Invoke(lib, function_name, 2, args);
304 return err; 302 return err;
305 } 303 }
306 304
307 305
308 // Statically allocated Dart_CObject instances for immutable 306 // Statically allocated Dart_CObject instances for immutable
309 // objects. As these will be used by different threads the use of 307 // objects. As these will be used by different threads the use of
310 // these depends on the fact that the marking internally in the 308 // these depends on the fact that the marking internally in the
311 // Dart_CObject structure is not marking simple value objects. 309 // Dart_CObject structure is not marking simple value objects.
312 Dart_CObject CObject::api_null_ = { Dart_CObject::kNull , { 0 } }; 310 Dart_CObject CObject::api_null_ = { Dart_CObject::kNull , { 0 } };
313 Dart_CObject CObject::api_true_ = { Dart_CObject::kBool , { true } }; 311 Dart_CObject CObject::api_true_ = { Dart_CObject::kBool , { true } };
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 431
434 CObject* CObject::NewOSError(OSError* os_error) { 432 CObject* CObject::NewOSError(OSError* os_error) {
435 CObject* error_message = 433 CObject* error_message =
436 new CObjectString(CObject::NewString(os_error->message())); 434 new CObjectString(CObject::NewString(os_error->message()));
437 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 435 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
438 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 436 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
439 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 437 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
440 result->SetAt(2, error_message); 438 result->SetAt(2, error_message);
441 return result; 439 return result;
442 } 440 }
OLDNEW
« no previous file with comments | « runtime/bin/common.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698