| OLD | NEW |
| 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 "vm/unit_test.h" | 5 #include "vm/unit_test.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 dart_args); | 133 dart_args); |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 static ThreadLocalKey script_reload_key = kUnsetThreadLocalKey; | 137 static ThreadLocalKey script_reload_key = kUnsetThreadLocalKey; |
| 138 | 138 |
| 139 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 139 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
| 140 Dart_Handle library, | 140 Dart_Handle library, |
| 141 Dart_Handle url) { | 141 Dart_Handle url) { |
| 142 if (tag == Dart_kCanonicalizeUrl) { | 142 if (tag == Dart_kCanonicalizeUrl) { |
| 143 return Dart_DefaultCanonicalizeUrl(library, url); | 143 Dart_Handle library_url = Dart_LibraryUrl(library); |
| 144 if (Dart_IsError(library_url)) { |
| 145 return library_url; |
| 146 } |
| 147 return Dart_DefaultCanonicalizeUrl(library_url, url); |
| 144 } | 148 } |
| 145 if (tag == Dart_kScriptTag) { | 149 if (tag == Dart_kScriptTag) { |
| 146 // Reload request. | 150 // Reload request. |
| 147 ASSERT(script_reload_key != kUnsetThreadLocalKey); | 151 ASSERT(script_reload_key != kUnsetThreadLocalKey); |
| 148 const char* script_source = | 152 const char* script_source = |
| 149 reinterpret_cast<const char*>( | 153 reinterpret_cast<const char*>( |
| 150 OSThread::GetThreadLocal(script_reload_key)); | 154 OSThread::GetThreadLocal(script_reload_key)); |
| 151 ASSERT(script_source != NULL); | 155 ASSERT(script_source != NULL); |
| 152 OSThread::SetThreadLocal(script_reload_key, 0); | 156 OSThread::SetThreadLocal(script_reload_key, 0); |
| 153 return Dart_LoadScript(url, | 157 return Dart_LoadScript(url, |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 451 } |
| 448 // Copy the remainder of in to out. | 452 // Copy the remainder of in to out. |
| 449 while (*in != '\0') { | 453 while (*in != '\0') { |
| 450 *out++ = *in++; | 454 *out++ = *in++; |
| 451 } | 455 } |
| 452 *out = '\0'; | 456 *out = '\0'; |
| 453 } | 457 } |
| 454 | 458 |
| 455 | 459 |
| 456 } // namespace dart | 460 } // namespace dart |
| OLD | NEW |