Index: runtime/bin/isolate_data.h |
diff --git a/runtime/bin/isolate_data.h b/runtime/bin/isolate_data.h |
index e8b8d7346f7f44e5a848ecf2271f7451f11503ba..d3f411f8a0829d416e661642ddbf4d4f76cb2b63 100644 |
--- a/runtime/bin/isolate_data.h |
+++ b/runtime/bin/isolate_data.h |
@@ -24,11 +24,12 @@ class IsolateData { |
IsolateData(const char* url, |
const char* package_root, |
const char* packages_file) |
- : script_url(strdup(url)), |
+ : script_url((url != NULL) ? strdup(url) : NULL), |
package_root(NULL), |
packages_file(NULL), |
udp_receive_buffer(NULL), |
- load_async_id(-1) { |
+ load_async_id(-1), |
+ builtin_lib_(NULL) { |
if (package_root != NULL) { |
ASSERT(packages_file == NULL); |
this->package_root = strdup(package_root); |
@@ -46,6 +47,21 @@ class IsolateData { |
packages_file = NULL; |
free(udp_receive_buffer); |
udp_receive_buffer = NULL; |
+ if (builtin_lib_ != NULL) { |
+ Dart_DeletePersistentHandle(builtin_lib_); |
+ } |
+ } |
+ |
+ Dart_Handle builtin_lib() const { |
+ ASSERT(builtin_lib_ != NULL); |
+ ASSERT(!Dart_IsError(builtin_lib_)); |
+ return builtin_lib_; |
+ } |
+ void set_builtin_lib(Dart_Handle lib) { |
+ ASSERT(builtin_lib_ == NULL); |
+ ASSERT(lib != NULL); |
+ ASSERT(!Dart_IsError(lib)); |
+ builtin_lib_ = Dart_NewPersistentHandle(lib); |
} |
char* script_url; |
@@ -55,6 +71,8 @@ class IsolateData { |
int64_t load_async_id; |
private: |
+ Dart_Handle builtin_lib_; |
+ |
DISALLOW_COPY_AND_ASSIGN(IsolateData); |
}; |