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

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

Issue 2208553002: Simplify reload error reporting (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/isolate_reload.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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 ASSERT(script_reload_key != kUnsetThreadLocalKey); 284 ASSERT(script_reload_key != kUnsetThreadLocalKey);
285 ASSERT(OSThread::GetThreadLocal(script_reload_key) == 0); 285 ASSERT(OSThread::GetThreadLocal(script_reload_key) == 0);
286 // Store the new script in TLS. 286 // Store the new script in TLS.
287 OSThread::SetThreadLocal(script_reload_key, reinterpret_cast<uword>(script)); 287 OSThread::SetThreadLocal(script_reload_key, reinterpret_cast<uword>(script));
288 } 288 }
289 289
290 290
291 Dart_Handle TestCase::TriggerReload() { 291 Dart_Handle TestCase::TriggerReload() {
292 Isolate* isolate = Isolate::Current(); 292 Isolate* isolate = Isolate::Current();
293 JSONStream js; 293 JSONStream js;
294 294 bool success = false;
295 { 295 {
296 TransitionNativeToVM transition(Thread::Current()); 296 TransitionNativeToVM transition(Thread::Current());
297 isolate->ReloadSources(&js, 297 success = isolate->ReloadSources(&js,
298 false, // force_reload 298 false, // force_reload
299 true); // dont_delete_reload_context 299 true); // dont_delete_reload_context
300 fprintf(stderr, "RELOAD REPORT:\n%s\n", js.ToCString()); 300 fprintf(stderr, "RELOAD REPORT:\n%s\n", js.ToCString());
rmacnak 2016/08/03 19:55:25 OS::PrintErr
Cutch 2016/08/03 21:17:19 Acknowledged.
301 } 301 }
302 302
303 return Dart_FinalizeLoading(false); 303 if (success) {
304 return Dart_FinalizeLoading(false);
305 } else {
306 return Dart_Null();
rmacnak 2016/08/03 19:55:25 Shouldn't this return some kind of error?
Cutch 2016/08/03 21:17:19 In the unit tests we keep the reload context alive
307 }
304 } 308 }
305 309
306 310
307 Dart_Handle TestCase::GetReloadErrorOrRootLibrary() { 311 Dart_Handle TestCase::GetReloadErrorOrRootLibrary() {
308 Isolate* isolate = Isolate::Current(); 312 Isolate* isolate = Isolate::Current();
309 313
310 if (isolate->reload_context() != NULL && 314 if (isolate->reload_context() != NULL &&
311 isolate->reload_context()->reload_aborted()) { 315 isolate->reload_context()->reload_aborted()) {
312 // Return a handle to the error. 316 // Return a handle to the error.
313 return Api::NewHandle(Thread::Current(), 317 return Api::NewHandle(Thread::Current(),
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 491 }
488 // Copy the remainder of in to out. 492 // Copy the remainder of in to out.
489 while (*in != '\0') { 493 while (*in != '\0') {
490 *out++ = *in++; 494 *out++ = *in++;
491 } 495 }
492 *out = '\0'; 496 *out = '\0';
493 } 497 }
494 498
495 499
496 } // namespace dart 500 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698