OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/service.h" | 5 #include "vm/service.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 report.PrintJSON(js, | 2450 report.PrintJSON(js, |
2451 script, | 2451 script, |
2452 TokenPosition(start_pos), | 2452 TokenPosition(start_pos), |
2453 TokenPosition(end_pos)); | 2453 TokenPosition(end_pos)); |
2454 return true; | 2454 return true; |
2455 } | 2455 } |
2456 | 2456 |
2457 | 2457 |
2458 static const MethodParameter* reload_sources_params[] = { | 2458 static const MethodParameter* reload_sources_params[] = { |
2459 RUNNABLE_ISOLATE_PARAMETER, | 2459 RUNNABLE_ISOLATE_PARAMETER, |
| 2460 new BoolParameter("force", false), |
2460 NULL, | 2461 NULL, |
2461 }; | 2462 }; |
2462 | 2463 |
2463 | 2464 |
2464 static bool ReloadSources(Thread* thread, JSONStream* js) { | 2465 static bool ReloadSources(Thread* thread, JSONStream* js) { |
2465 Isolate* isolate = thread->isolate(); | 2466 Isolate* isolate = thread->isolate(); |
2466 if (!isolate->compilation_allowed()) { | 2467 if (!isolate->compilation_allowed()) { |
2467 js->PrintError(kFeatureDisabled, | 2468 js->PrintError(kFeatureDisabled, |
2468 "Cannot reload source when running a precompiled program."); | 2469 "Cannot reload source when running a precompiled program."); |
2469 return true; | 2470 return true; |
(...skipping 12 matching lines...) Expand all Loading... |
2482 if (isolate->IsReloading()) { | 2483 if (isolate->IsReloading()) { |
2483 js->PrintError(kIsolateIsReloading, | 2484 js->PrintError(kIsolateIsReloading, |
2484 "This isolate is being reloaded."); | 2485 "This isolate is being reloaded."); |
2485 return true; | 2486 return true; |
2486 } | 2487 } |
2487 if (!isolate->CanReload()) { | 2488 if (!isolate->CanReload()) { |
2488 js->PrintError(kFeatureDisabled, | 2489 js->PrintError(kFeatureDisabled, |
2489 "This isolate cannot reload sources right now."); | 2490 "This isolate cannot reload sources right now."); |
2490 return true; | 2491 return true; |
2491 } | 2492 } |
| 2493 const bool force_reload = |
| 2494 BoolParameter::Parse(js->LookupParam("force"), false); |
2492 | 2495 |
2493 isolate->ReloadSources(); | 2496 isolate->ReloadSources(force_reload); |
2494 | 2497 |
2495 const Error& error = Error::Handle(isolate->sticky_reload_error()); | 2498 const Error& error = Error::Handle(isolate->sticky_reload_error()); |
2496 | 2499 |
2497 if (error.IsNull()) { | 2500 if (error.IsNull()) { |
2498 PrintSuccess(js); | 2501 PrintSuccess(js); |
2499 } else { | 2502 } else { |
2500 // Clear the sticky error. | 2503 // Clear the sticky error. |
2501 isolate->clear_sticky_reload_error(); | 2504 isolate->clear_sticky_reload_error(); |
2502 js->PrintError(kIsolateReloadFailed, | 2505 js->PrintError(kIsolateReloadFailed, |
2503 "Isolate reload failed: %s", error.ToErrorCString()); | 2506 "Isolate reload failed: %s", error.ToErrorCString()); |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4131 if (strcmp(method_name, method.name) == 0) { | 4134 if (strcmp(method_name, method.name) == 0) { |
4132 return &method; | 4135 return &method; |
4133 } | 4136 } |
4134 } | 4137 } |
4135 return NULL; | 4138 return NULL; |
4136 } | 4139 } |
4137 | 4140 |
4138 #endif // !PRODUCT | 4141 #endif // !PRODUCT |
4139 | 4142 |
4140 } // namespace dart | 4143 } // namespace dart |
OLD | NEW |