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

Side by Side Diff: runtime/vm/unit_test.cc

Issue 2998983002: 1. Figure out the modified libraries from the specifeid kernel file during (Closed)
Patch Set: Fix format errors. Created 3 years, 4 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
« runtime/vm/isolate_reload.cc ('K') | « runtime/vm/kernel_reader.cc ('k') | no next file » | 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 "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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 return NULL; 208 return NULL;
209 } 209 }
210 210
211 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, 211 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
212 Dart_Handle library, 212 Dart_Handle library,
213 Dart_Handle url) { 213 Dart_Handle url) {
214 if (FLAG_use_dart_frontend) { 214 if (FLAG_use_dart_frontend) {
215 // Reload request. 215 // Reload request.
216 216
217 ASSERT(tag == Dart_kKernelTag);
217 const char* urlstr = NULL; 218 const char* urlstr = NULL;
218 Dart_Handle result = Dart_StringToCString(url, &urlstr); 219 Dart_Handle result = Dart_StringToCString(url, &urlstr);
219 if (Dart_IsError(result)) { 220 if (Dart_IsError(result)) {
220 return Dart_NewApiError("accessing url characters failed"); 221 return Dart_NewApiError("accessing url characters failed");
221 } 222 }
222 223
223 // Updated library either arrives as dart source or as 224 // Updated library either arrives as dart source or as
224 // a precompiled kernel binary. 225 // a precompiled kernel binary.
225 void* kernel_pgm; 226 void* kernel_pgm;
226 if (script_reload_key != kUnsetThreadLocalKey) { 227 if (script_reload_key != kUnsetThreadLocalKey) {
227 const char* script_source = reinterpret_cast<const char*>( 228 const char* script_source = reinterpret_cast<const char*>(
228 OSThread::GetThreadLocal(script_reload_key)); 229 OSThread::GetThreadLocal(script_reload_key));
229 ASSERT(script_source != NULL); 230 ASSERT(script_source != NULL);
230 OSThread::SetThreadLocal(script_reload_key, 0); 231 OSThread::SetThreadLocal(script_reload_key, 0);
231 char* error = TestCase::CompileTestScriptWithDFE(urlstr, script_source, 232 char* error = TestCase::CompileTestScriptWithDFE(urlstr, script_source,
232 &kernel_pgm); 233 &kernel_pgm);
233 if (error != NULL) { 234 if (error != NULL) {
234 return Dart_NewApiError(error); 235 return Dart_NewApiError(error);
235 } 236 }
236 } else { 237 } else {
237 ASSERT(kernel_reload_key != kUnsetThreadLocalKey); 238 ASSERT(kernel_reload_key != kUnsetThreadLocalKey);
238 kernel_pgm = 239 kernel_pgm =
239 reinterpret_cast<void*>(OSThread::GetThreadLocal(kernel_reload_key)); 240 reinterpret_cast<void*>(OSThread::GetThreadLocal(kernel_reload_key));
240 ASSERT(kernel_pgm != NULL);
241 OSThread::SetThreadLocal(kernel_reload_key, 0); 241 OSThread::SetThreadLocal(kernel_reload_key, 0);
242 } 242 }
243 return Dart_LoadScript(url, Dart_Null(), 243 ASSERT(kernel_pgm != NULL);
244 reinterpret_cast<Dart_Handle>(kernel_pgm), 0, 0); 244 return Dart_NewExternalTypedData(Dart_TypedData_kUint64, kernel_pgm, 1);
245 } 245 }
246 if (tag == Dart_kCanonicalizeUrl) { 246 if (tag == Dart_kCanonicalizeUrl) {
247 Dart_Handle library_url = Dart_LibraryUrl(library); 247 Dart_Handle library_url = Dart_LibraryUrl(library);
248 if (Dart_IsError(library_url)) { 248 if (Dart_IsError(library_url)) {
249 return library_url; 249 return library_url;
250 } 250 }
251 return Dart_DefaultCanonicalizeUrl(library_url, url); 251 return Dart_DefaultCanonicalizeUrl(library_url, url);
252 } 252 }
253 if (tag == Dart_kScriptTag) { 253 if (tag == Dart_kScriptTag) {
254 // Reload request. 254 // Reload request.
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 pos = strstr(in, prefix); 622 pos = strstr(in, prefix);
623 } 623 }
624 // Copy the remainder of in to out. 624 // Copy the remainder of in to out.
625 while (*in != '\0') { 625 while (*in != '\0') {
626 *out++ = *in++; 626 *out++ = *in++;
627 } 627 }
628 *out = '\0'; 628 *out = '\0';
629 } 629 }
630 630
631 } // namespace dart 631 } // namespace dart
OLDNEW
« runtime/vm/isolate_reload.cc ('K') | « runtime/vm/kernel_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698