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

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

Issue 11275035: Introduce (private) ZLibFilter to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add InternalError class and LICENSE file. Created 8 years, 1 month 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
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/extensions.h" 7 #include "bin/extensions.h"
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 #include "bin/file.h" 9 #include "bin/file.h"
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 Dart_Handle args[2]; 502 Dart_Handle args[2];
503 args[0] = Dart_NewString(os_error->message()); 503 args[0] = Dart_NewString(os_error->message());
504 if (Dart_IsError(args[0])) return args[0]; 504 if (Dart_IsError(args[0])) return args[0];
505 args[1] = Dart_NewInteger(os_error->code()); 505 args[1] = Dart_NewInteger(os_error->code());
506 if (Dart_IsError(args[1])) return args[1]; 506 if (Dart_IsError(args[1])) return args[1];
507 Dart_Handle err = Dart_New(clazz, Dart_Null(), 2, args); 507 Dart_Handle err = Dart_New(clazz, Dart_Null(), 2, args);
508 return err; 508 return err;
509 } 509 }
510 510
511 511
512 Dart_Handle DartUtils::NewInternalError(const char* message) {
513 Dart_Handle url = Dart_NewString("dart:io");
514 if (Dart_IsError(url)) return url;
515 Dart_Handle lib = Dart_LookupLibrary(url);
516 if (Dart_IsError(lib)) return lib;
517 Dart_Handle class_name = Dart_NewString("InternalError");
518 if (Dart_IsError(class_name)) return class_name;
519 Dart_Handle clazz = Dart_GetClass(lib, class_name);
520 if (Dart_IsError(clazz)) return clazz;
521 Dart_Handle args[1];
522 args[0] = Dart_NewString(message);
523 if (Dart_IsError(args[0])) return args[0];
524 Dart_Handle err = Dart_New(clazz, Dart_Null(), 1, args);
525 return err;
526 }
527
528
512 void DartUtils::SetOriginalWorkingDirectory() { 529 void DartUtils::SetOriginalWorkingDirectory() {
513 original_working_directory = Directory::Current(); 530 original_working_directory = Directory::Current();
514 } 531 }
515 532
516 533
517 // Statically allocated Dart_CObject instances for immutable 534 // Statically allocated Dart_CObject instances for immutable
518 // objects. As these will be used by different threads the use of 535 // objects. As these will be used by different threads the use of
519 // these depends on the fact that the marking internally in the 536 // these depends on the fact that the marking internally in the
520 // Dart_CObject structure is not marking simple value objects. 537 // Dart_CObject structure is not marking simple value objects.
521 Dart_CObject CObject::api_null_ = { Dart_CObject::kNull , { 0 } }; 538 Dart_CObject CObject::api_null_ = { Dart_CObject::kNull , { 0 } };
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 672
656 CObject* CObject::NewOSError(OSError* os_error) { 673 CObject* CObject::NewOSError(OSError* os_error) {
657 CObject* error_message = 674 CObject* error_message =
658 new CObjectString(CObject::NewString(os_error->message())); 675 new CObjectString(CObject::NewString(os_error->message()));
659 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 676 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
660 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 677 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
661 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 678 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
662 result->SetAt(2, error_message); 679 result->SetAt(2, error_message);
663 return result; 680 return result;
664 } 681 }
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/filter.h » ('j') | runtime/third_party/zlib/LICENSE » ('J')

Powered by Google App Engine
This is Rietveld 408576698