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

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

Issue 15966002: Add support for loading scripts from http (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
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_DARTUTILS_H_ 5 #ifndef BIN_DARTUTILS_H_
6 #define BIN_DARTUTILS_H_ 6 #define BIN_DARTUTILS_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 intptr_t val); 99 intptr_t val);
100 static intptr_t GetIntegerField(Dart_Handle handle, 100 static intptr_t GetIntegerField(Dart_Handle handle,
101 const char* name); 101 const char* name);
102 static void SetStringField(Dart_Handle handle, 102 static void SetStringField(Dart_Handle handle,
103 const char* name, 103 const char* name,
104 const char* val); 104 const char* val);
105 static bool IsDartSchemeURL(const char* url_name); 105 static bool IsDartSchemeURL(const char* url_name);
106 static bool IsDartExtensionSchemeURL(const char* url_name); 106 static bool IsDartExtensionSchemeURL(const char* url_name);
107 static bool IsDartIOLibURL(const char* url_name); 107 static bool IsDartIOLibURL(const char* url_name);
108 static bool IsDartBuiltinLibURL(const char* url_name); 108 static bool IsDartBuiltinLibURL(const char* url_name);
109 static bool IsHttpSchemeURL(const char* url_name);
109 static Dart_Handle CanonicalizeURL(CommandLineOptions* url_mapping, 110 static Dart_Handle CanonicalizeURL(CommandLineOptions* url_mapping,
110 Dart_Handle library, 111 Dart_Handle library,
111 const char* url_str); 112 const char* url_str);
112 static void* OpenFile(const char* name, bool write); 113 static void* OpenFile(const char* name, bool write);
113 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream); 114 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream);
114 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream); 115 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream);
115 static void CloseFile(void* stream); 116 static void CloseFile(void* stream);
116 static Dart_Handle ReadStringFromFile(const char* filename); 117 static Dart_Handle ReadStringFromFile(const char* filename);
118 static Dart_Handle ReadStringFromHttp(const char* filename);
117 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, 119 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
118 Dart_Handle library, 120 Dart_Handle library,
119 Dart_Handle url); 121 Dart_Handle url);
120 static Dart_Handle LoadScript(const char* script_uri, 122 static Dart_Handle LoadScript(const char* script_uri,
121 Dart_Handle builtin_lib); 123 Dart_Handle builtin_lib);
124 static Dart_Handle LoadScriptHttp(const char* script_uri,
125 Dart_Handle builtin_lib);
122 static Dart_Handle LoadSource(CommandLineOptions* url_mapping, 126 static Dart_Handle LoadSource(CommandLineOptions* url_mapping,
123 Dart_Handle library, 127 Dart_Handle library,
124 Dart_Handle url, 128 Dart_Handle url,
125 Dart_LibraryTag tag, 129 Dart_LibraryTag tag,
126 const char* filename); 130 const char* filename);
127 static Dart_Handle PrepareForScriptLoading(const char* package_root, 131 static Dart_Handle PrepareForScriptLoading(const char* package_root,
128 Dart_Handle builtin_lib); 132 Dart_Handle builtin_lib);
129 133
130 static bool PostNull(Dart_Port port_id); 134 static bool PostNull(Dart_Port port_id);
131 static bool PostInt32(Dart_Port port_id, int32_t value); 135 static bool PostInt32(Dart_Port port_id, int32_t value);
(...skipping 25 matching lines...) Expand all
157 161
158 static const char* MapLibraryUrl(CommandLineOptions* url_mapping, 162 static const char* MapLibraryUrl(CommandLineOptions* url_mapping,
159 const char* url_string); 163 const char* url_string);
160 164
161 static Dart_Handle ResolveScriptUri(Dart_Handle script_uri, 165 static Dart_Handle ResolveScriptUri(Dart_Handle script_uri,
162 Dart_Handle builtin_lib); 166 Dart_Handle builtin_lib);
163 167
164 static Dart_Handle FilePathFromUri(Dart_Handle script_uri, 168 static Dart_Handle FilePathFromUri(Dart_Handle script_uri,
165 Dart_Handle builtin_lib); 169 Dart_Handle builtin_lib);
166 170
171 static Dart_Handle PathFromUri(Dart_Handle script_uri,
172 Dart_Handle builtin_lib);
173
174 static Dart_Handle DomainFromUri(Dart_Handle script_uri,
175 Dart_Handle builtin_lib);
176
177 static Dart_Handle PortFromUri(Dart_Handle script_uri,
178 Dart_Handle builtin_lib);
179
167 static Dart_Handle ResolveUri(Dart_Handle library_url, 180 static Dart_Handle ResolveUri(Dart_Handle library_url,
168 Dart_Handle url, 181 Dart_Handle url,
169 Dart_Handle builtin_lib); 182 Dart_Handle builtin_lib);
170 183
171 // Sniffs the specified text_buffer to see if it contains the magic number 184 // Sniffs the specified text_buffer to see if it contains the magic number
172 // representing a script snapshot. If the text_buffer is a script snapshot 185 // representing a script snapshot. If the text_buffer is a script snapshot
173 // the return value is an updated pointer to the text_buffer pointing past 186 // the return value is an updated pointer to the text_buffer pointing past
174 // the magic number value. The 'buffer_len' parameter is also appropriately 187 // the magic number value. The 'buffer_len' parameter is also appropriately
175 // adjusted. 188 // adjusted.
176 static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer, 189 static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer,
177 intptr_t* buffer_len, 190 intptr_t* buffer_len,
178 bool* is_snapshot); 191 bool* is_snapshot);
179 192
180 // Write a magic number to indicate a script snapshot file. 193 // Write a magic number to indicate a script snapshot file.
181 static void WriteMagicNumber(File* file); 194 static void WriteMagicNumber(File* file);
182 195
183 // Global state that stores the original working directory.. 196 // Global state that stores the original working directory..
184 static const char* original_working_directory; 197 static const char* original_working_directory;
185 198
186 static const char* kDartScheme; 199 static const char* kDartScheme;
187 static const char* kDartExtensionScheme; 200 static const char* kDartExtensionScheme;
188 static const char* kAsyncLibURL; 201 static const char* kAsyncLibURL;
189 static const char* kBuiltinLibURL; 202 static const char* kBuiltinLibURL;
190 static const char* kCoreLibURL; 203 static const char* kCoreLibURL;
191 static const char* kIOLibURL; 204 static const char* kIOLibURL;
192 static const char* kIOLibPatchURL; 205 static const char* kIOLibPatchURL;
193 static const char* kUriLibURL; 206 static const char* kUriLibURL;
207 static const char* kHttpScheme;
194 208
195 static const char* kIdFieldName; 209 static const char* kIdFieldName;
196 210
197 static uint8_t magic_number[]; 211 static uint8_t magic_number[];
198 212
199 private: 213 private:
200 static const char* GetCanonicalPath(const char* reference_dir, 214 static const char* GetCanonicalPath(const char* reference_dir,
201 const char* filename); 215 const char* filename);
202 216
203 DISALLOW_ALLOCATION(); 217 DISALLOW_ALLOCATION();
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 515 }
502 516
503 private: 517 private:
504 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); 518 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array);
505 }; 519 };
506 520
507 } // namespace bin 521 } // namespace bin
508 } // namespace dart 522 } // namespace dart
509 523
510 #endif // BIN_DARTUTILS_H_ 524 #endif // BIN_DARTUTILS_H_
OLDNEW
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/bin/dartutils.cc » ('j') | runtime/bin/dartutils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698