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

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

Issue 12318031: Move json, uri, utf and crypto libraries into the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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/builtin_gen_snapshot.cc ('k') | runtime/bin/crypto_sources.gypi » ('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) 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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
11 #include "bin/io_natives.h" 11 #include "bin/io_natives.h"
12 12
13 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = { 13 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
14 /* { url_, source_, patch_url_, patch_source_, has_natives_ } */ 14 /* { url_, source_, patch_url_, patch_source_, has_natives_ } */
15 { DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true }, 15 { DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true },
16 { DartUtils::kJsonLibURL, NULL, NULL, NULL, false },
17 { DartUtils::kUriLibURL, NULL, NULL, NULL, false },
18 { DartUtils::kCryptoLibURL, NULL, NULL, NULL, false },
19 { DartUtils::kIOLibURL, NULL, NULL, NULL, true }, 16 { DartUtils::kIOLibURL, NULL, NULL, NULL, true },
20 { DartUtils::kUtfLibURL, NULL, NULL, NULL, false }
21 }; 17 };
22 18
23 19
24 Dart_Handle Builtin::Source(BuiltinLibraryId id) { 20 Dart_Handle Builtin::Source(BuiltinLibraryId id) {
25 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == 21 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) ==
26 kInvalidLibrary); 22 kInvalidLibrary);
27 return Dart_NewApiError("Unreachable code in Builtin::Source (%d).", id); 23 return Dart_NewApiError("Unreachable code in Builtin::Source (%d).", id);
28 } 24 }
29 25
30 /** 26 /**
(...skipping 20 matching lines...) Expand all
51 } 47 }
52 48
53 49
54 Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) { 50 Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
55 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == 51 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) ==
56 kInvalidLibrary); 52 kInvalidLibrary);
57 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); 53 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary);
58 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_); 54 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
59 Dart_Handle library = Dart_LookupLibrary(url); 55 Dart_Handle library = Dart_LookupLibrary(url);
60 if (Dart_IsError(library)) { 56 if (Dart_IsError(library)) {
61 ASSERT(id > kUtfLibrary); 57 ASSERT(id > kIOLibrary);
62 library = Dart_LoadLibrary(url, Source(id)); 58 library = Dart_LoadLibrary(url, Source(id));
63 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) { 59 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) {
64 // Setup the native resolver for built in library functions. 60 // Setup the native resolver for built in library functions.
65 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup)); 61 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup));
66 } 62 }
67 } 63 }
68 DART_CHECK_VALID(library); 64 DART_CHECK_VALID(library);
69 return library; 65 return library;
70 } 66 }
OLDNEW
« no previous file with comments | « runtime/bin/builtin_gen_snapshot.cc ('k') | runtime/bin/crypto_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698