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

Side by Side Diff: runtime/bin/builtin.h

Issue 1916793003: - Allow for loading dart:html and friends into the standalone (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase. Created 4 years, 7 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
« no previous file with comments | « runtime/bin/bin.gypi ('k') | runtime/bin/builtin.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) 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 #ifndef BIN_BUILTIN_H_ 5 #ifndef BIN_BUILTIN_H_
6 #define BIN_BUILTIN_H_ 6 #define BIN_BUILTIN_H_
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 12 matching lines...) Expand all
23 extern void FUNCTION_NAME(name)(Dart_NativeArguments args); 23 extern void FUNCTION_NAME(name)(Dart_NativeArguments args);
24 24
25 25
26 class Builtin { 26 class Builtin {
27 public: 27 public:
28 // Note: Changes to this enum should be accompanied with changes to 28 // Note: Changes to this enum should be accompanied with changes to
29 // the builtin_libraries_ array in builtin.cc and builtin_nolib.cc. 29 // the builtin_libraries_ array in builtin.cc and builtin_nolib.cc.
30 enum BuiltinLibraryId { 30 enum BuiltinLibraryId {
31 kBuiltinLibrary = 0, 31 kBuiltinLibrary = 0,
32 kIOLibrary, 32 kIOLibrary,
33 33 #if defined(DART_NO_SNAPSHOT)
34 // Only include these libraries in the dart_bootstrap case for now.
35 kHTMLLibrary,
36 kHTMLCommonLibrary,
37 kJSLibrary,
38 kBlinkLibrary,
39 kIndexedDbLibrary,
40 kCachedPatchesLibrary,
41 kWebGlLibrary,
42 kMetaDataLibrary,
43 kWebSqlLibrary,
44 kSvgLibrary,
45 kWebAudioLibrary,
46 #endif // defined(DART_NO_SNAPSHOT)
34 kInvalidLibrary, 47 kInvalidLibrary,
35 }; 48 };
36 49
37 // Get source corresponding to built in library specified in 'id'. 50 // Get source corresponding to built in library specified in 'id'.
38 static Dart_Handle Source(BuiltinLibraryId id); 51 static Dart_Handle Source(BuiltinLibraryId id);
39 52
40 // Get source of part file specified in 'uri'. 53 // Get source of part file specified in 'uri'.
41 static Dart_Handle PartSource(BuiltinLibraryId id, const char* part_uri); 54 static Dart_Handle PartSource(BuiltinLibraryId id, const char* part_uri);
42 55
43 // Setup native resolver method built in library specified in 'id'. 56 // Setup native resolver method built in library specified in 'id'.
44 static void SetNativeResolver(BuiltinLibraryId id); 57 static void SetNativeResolver(BuiltinLibraryId id);
45 58
46 static Dart_Handle LoadLibrary(Dart_Handle url, BuiltinLibraryId id); 59 static Dart_Handle LoadLibrary(Dart_Handle url, BuiltinLibraryId id);
60 static BuiltinLibraryId FindId(const char* url_string);
47 61
48 // Check if built in library specified in 'id' is already loaded, if not 62 // Check if built in library specified in 'id' is already loaded, if not
49 // load it. 63 // load it.
50 static Dart_Handle LoadAndCheckLibrary(BuiltinLibraryId id); 64 static Dart_Handle LoadAndCheckLibrary(BuiltinLibraryId id);
51 65
52 static Dart_Handle SetLoadPort(Dart_Port port); 66 static Dart_Handle SetLoadPort(Dart_Port port);
53 67
54 private: 68 private:
55 // Map specified URI to an actual file name from 'source_paths' and read 69 // Map specified URI to an actual file name from 'source_paths' and read
56 // the file. 70 // the file.
57 static Dart_Handle GetSource(const char** source_paths, const char* uri); 71 static Dart_Handle GetSource(const char** source_paths, const char* uri);
58 72
59 // Native method support. 73 // Native method support.
60 static Dart_NativeFunction NativeLookup(Dart_Handle name, 74 static Dart_NativeFunction NativeLookup(Dart_Handle name,
61 int argument_count, 75 int argument_count,
62 bool* auto_setup_scope); 76 bool* auto_setup_scope);
63 77
64 static const uint8_t* NativeSymbol(Dart_NativeFunction nf); 78 static const uint8_t* NativeSymbol(Dart_NativeFunction nf);
65 79
66 static const char* _builtin_source_paths_[]; 80 static const char* _builtin_source_paths_[];
67 static const char* io_source_paths_[]; 81 static const char* io_source_paths_[];
68 static const char* io_patch_paths_[]; 82 static const char* io_patch_paths_[];
83 static const char* html_source_paths_[];
84 static const char* html_common_source_paths_[];
85 static const char* js_source_paths_[];
86 static const char* blink_source_paths_[];
87 static const char* indexeddb_source_paths_[];
88 static const char* cached_patches_source_paths_[];
89 static const char* web_gl_source_paths_[];
90 static const char* metadata_source_paths_[];
91 static const char* websql_source_paths_[];
92 static const char* svg_source_paths_[];
93 static const char* webaudio_source_paths_[];
94
69 static Dart_Port load_port_; 95 static Dart_Port load_port_;
70 96
71 typedef struct { 97 typedef struct {
72 const char* url_; 98 const char* url_;
73 const char** source_paths_; 99 const char** source_paths_;
74 const char* patch_url_; 100 const char* patch_url_;
75 const char** patch_paths_; 101 const char** patch_paths_;
76 bool has_natives_; 102 bool has_natives_;
77 } builtin_lib_props; 103 } builtin_lib_props;
78 static builtin_lib_props builtin_libraries_[]; 104 static builtin_lib_props builtin_libraries_[];
79 105
80 DISALLOW_ALLOCATION(); 106 DISALLOW_ALLOCATION();
81 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin); 107 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin);
82 }; 108 };
83 109
84 } // namespace bin 110 } // namespace bin
85 } // namespace dart 111 } // namespace dart
86 112
87 #endif // BIN_BUILTIN_H_ 113 #endif // BIN_BUILTIN_H_
OLDNEW
« no previous file with comments | « runtime/bin/bin.gypi ('k') | runtime/bin/builtin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698