| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 545 |
| 546 class IdParameter : public MethodParameter { | 546 class IdParameter : public MethodParameter { |
| 547 public: | 547 public: |
| 548 IdParameter(const char* name, bool required) | 548 IdParameter(const char* name, bool required) |
| 549 : MethodParameter(name, required) {} | 549 : MethodParameter(name, required) {} |
| 550 | 550 |
| 551 virtual bool Validate(const char* value) const { return (value != NULL); } | 551 virtual bool Validate(const char* value) const { return (value != NULL); } |
| 552 }; | 552 }; |
| 553 | 553 |
| 554 | 554 |
| 555 class StringParameter : public MethodParameter { |
| 556 public: |
| 557 StringParameter(const char* name, bool required) |
| 558 : MethodParameter(name, required) {} |
| 559 |
| 560 virtual bool Validate(const char* value) const { return (value != NULL); } |
| 561 }; |
| 562 |
| 563 |
| 555 class RunnableIsolateParameter : public MethodParameter { | 564 class RunnableIsolateParameter : public MethodParameter { |
| 556 public: | 565 public: |
| 557 explicit RunnableIsolateParameter(const char* name) | 566 explicit RunnableIsolateParameter(const char* name) |
| 558 : MethodParameter(name, true) {} | 567 : MethodParameter(name, true) {} |
| 559 | 568 |
| 560 virtual bool Validate(const char* value) const { | 569 virtual bool Validate(const char* value) const { |
| 561 Isolate* isolate = Isolate::Current(); | 570 Isolate* isolate = Isolate::Current(); |
| 562 return (value != NULL) && (isolate != NULL) && (isolate->is_runnable()); | 571 return (value != NULL) && (isolate != NULL) && (isolate->is_runnable()); |
| 563 } | 572 } |
| 564 | 573 |
| (...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2435 } | 2444 } |
| 2436 } | 2445 } |
| 2437 SourceReport report(report_set, compile_mode); | 2446 SourceReport report(report_set, compile_mode); |
| 2438 report.PrintJSON(js, script, TokenPosition(start_pos), | 2447 report.PrintJSON(js, script, TokenPosition(start_pos), |
| 2439 TokenPosition(end_pos)); | 2448 TokenPosition(end_pos)); |
| 2440 return true; | 2449 return true; |
| 2441 } | 2450 } |
| 2442 | 2451 |
| 2443 | 2452 |
| 2444 static const MethodParameter* reload_sources_params[] = { | 2453 static const MethodParameter* reload_sources_params[] = { |
| 2445 RUNNABLE_ISOLATE_PARAMETER, new BoolParameter("force", false), | 2454 RUNNABLE_ISOLATE_PARAMETER, |
| 2446 new BoolParameter("pause", false), NULL, | 2455 new BoolParameter("force", false), |
| 2456 new BoolParameter("pause", false), |
| 2457 new StringParameter("rootLibUri", false), |
| 2458 new StringParameter("packagesUri", false), |
| 2459 NULL, |
| 2447 }; | 2460 }; |
| 2448 | 2461 |
| 2449 | 2462 |
| 2450 static bool ReloadSources(Thread* thread, JSONStream* js) { | 2463 static bool ReloadSources(Thread* thread, JSONStream* js) { |
| 2451 Isolate* isolate = thread->isolate(); | 2464 Isolate* isolate = thread->isolate(); |
| 2452 if (!isolate->compilation_allowed()) { | 2465 if (!isolate->compilation_allowed()) { |
| 2453 js->PrintError(kFeatureDisabled, | 2466 js->PrintError(kFeatureDisabled, |
| 2454 "Cannot reload source when running a precompiled program."); | 2467 "Cannot reload source when running a precompiled program."); |
| 2455 return true; | 2468 return true; |
| 2456 } | 2469 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2477 return true; | 2490 return true; |
| 2478 } | 2491 } |
| 2479 if (!isolate->CanReload()) { | 2492 if (!isolate->CanReload()) { |
| 2480 js->PrintError(kFeatureDisabled, | 2493 js->PrintError(kFeatureDisabled, |
| 2481 "This isolate cannot reload sources right now."); | 2494 "This isolate cannot reload sources right now."); |
| 2482 return true; | 2495 return true; |
| 2483 } | 2496 } |
| 2484 const bool force_reload = | 2497 const bool force_reload = |
| 2485 BoolParameter::Parse(js->LookupParam("force"), false); | 2498 BoolParameter::Parse(js->LookupParam("force"), false); |
| 2486 | 2499 |
| 2487 isolate->ReloadSources(js, force_reload); | 2500 isolate->ReloadSources(js, force_reload, js->LookupParam("rootLibUri"), |
| 2501 js->LookupParam("packagesUri")); |
| 2488 | 2502 |
| 2489 Service::CheckForPause(isolate, js); | 2503 Service::CheckForPause(isolate, js); |
| 2490 | 2504 |
| 2491 return true; | 2505 return true; |
| 2492 } | 2506 } |
| 2493 | 2507 |
| 2494 | 2508 |
| 2495 void Service::CheckForPause(Isolate* isolate, JSONStream* stream) { | 2509 void Service::CheckForPause(Isolate* isolate, JSONStream* stream) { |
| 2496 // Should we pause? | 2510 // Should we pause? |
| 2497 isolate->set_should_pause_post_service_request( | 2511 isolate->set_should_pause_post_service_request( |
| (...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 if (strcmp(method_name, method.name) == 0) { | 4086 if (strcmp(method_name, method.name) == 0) { |
| 4073 return &method; | 4087 return &method; |
| 4074 } | 4088 } |
| 4075 } | 4089 } |
| 4076 return NULL; | 4090 return NULL; |
| 4077 } | 4091 } |
| 4078 | 4092 |
| 4079 #endif // !PRODUCT | 4093 #endif // !PRODUCT |
| 4080 | 4094 |
| 4081 } // namespace dart | 4095 } // namespace dart |
| OLD | NEW |