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

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

Issue 2512483002: Support reloading from source on top of a script snapshot. (Closed)
Patch Set: ... Created 4 years, 1 month 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/object_reload.cc ('k') | runtime/vm/unit_test.cc » ('j') | 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) 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
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
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 15 matching lines...) Expand all
2472 return true; 2485 return true;
2473 } 2486 }
2474 if (!isolate->CanReload()) { 2487 if (!isolate->CanReload()) {
2475 js->PrintError(kFeatureDisabled, 2488 js->PrintError(kFeatureDisabled,
2476 "This isolate cannot reload sources right now."); 2489 "This isolate cannot reload sources right now.");
2477 return true; 2490 return true;
2478 } 2491 }
2479 const bool force_reload = 2492 const bool force_reload =
2480 BoolParameter::Parse(js->LookupParam("force"), false); 2493 BoolParameter::Parse(js->LookupParam("force"), false);
2481 2494
2482 isolate->ReloadSources(js, force_reload); 2495 isolate->ReloadSources(js, force_reload, js->LookupParam("rootLibUri"),
2496 js->LookupParam("packagesUri"));
2483 2497
2484 Service::CheckForPause(isolate, js); 2498 Service::CheckForPause(isolate, js);
2485 2499
2486 return true; 2500 return true;
2487 } 2501 }
2488 2502
2489 2503
2490 void Service::CheckForPause(Isolate* isolate, JSONStream* stream) { 2504 void Service::CheckForPause(Isolate* isolate, JSONStream* stream) {
2491 // Should we pause? 2505 // Should we pause?
2492 isolate->set_should_pause_post_service_request( 2506 isolate->set_should_pause_post_service_request(
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
4067 if (strcmp(method_name, method.name) == 0) { 4081 if (strcmp(method_name, method.name) == 0) {
4068 return &method; 4082 return &method;
4069 } 4083 }
4070 } 4084 }
4071 return NULL; 4085 return NULL;
4072 } 4086 }
4073 4087
4074 #endif // !PRODUCT 4088 #endif // !PRODUCT
4075 4089
4076 } // namespace dart 4090 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_reload.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698