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

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

Issue 2213753002: Fix reload service protocol 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 | « no previous file | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/isolate_reload.h" 5 #include "vm/isolate_reload.h"
6 6
7 #include "vm/become.h" 7 #include "vm/become.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // Grab root library before calling CheckpointBeforeReload. 435 // Grab root library before calling CheckpointBeforeReload.
436 const Library& root_lib = Library::Handle(object_store()->root_library()); 436 const Library& root_lib = Library::Handle(object_store()->root_library());
437 ASSERT(!root_lib.IsNull()); 437 ASSERT(!root_lib.IsNull());
438 const String& root_lib_url = String::Handle(root_lib.url()); 438 const String& root_lib_url = String::Handle(root_lib.url());
439 439
440 // Check to see which libraries have been modified. 440 // Check to see which libraries have been modified.
441 modified_libs_ = FindModifiedLibraries(force_reload); 441 modified_libs_ = FindModifiedLibraries(force_reload);
442 if (!modified_libs_->Contains(root_lib.index())) { 442 if (!modified_libs_->Contains(root_lib.index())) {
443 ASSERT(modified_libs_->IsEmpty()); 443 ASSERT(modified_libs_->IsEmpty());
444 reload_skipped_ = true; 444 reload_skipped_ = true;
445 ReportOnJSON(js_);
445 TIR_Print("---- SKIPPING RELOAD (No libraries were modified)\n"); 446 TIR_Print("---- SKIPPING RELOAD (No libraries were modified)\n");
446 return; 447 return;
447 } 448 }
448 449
449 TIR_Print("---- STARTING RELOAD\n"); 450 TIR_Print("---- STARTING RELOAD\n");
450 451
451 // Preallocate storage for maps. 452 // Preallocate storage for maps.
452 old_classes_set_storage_ = 453 old_classes_set_storage_ =
453 HashTables::New<UnorderedHashSet<ClassMapTraits> >(4); 454 HashTables::New<UnorderedHashSet<ClassMapTraits> >(4);
454 class_map_storage_ = 455 class_map_storage_ =
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 } 590 }
590 591
591 592
592 void IsolateReloadContext::CommonFinalizeTail() { 593 void IsolateReloadContext::CommonFinalizeTail() {
593 ReportOnJSON(js_); 594 ReportOnJSON(js_);
594 reload_finalized_ = true; 595 reload_finalized_ = true;
595 } 596 }
596 597
597 598
598 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { 599 void IsolateReloadContext::ReportOnJSON(JSONStream* stream) {
599 // Clear the buffer.
600 stream->buffer()->Clear();
601 JSONObject jsobj(stream); 600 JSONObject jsobj(stream);
602 jsobj.AddProperty("type", "ReloadReport"); 601 jsobj.AddProperty("type", "ReloadReport");
603 jsobj.AddProperty("success", !HasReasonsForCancelling()); 602 jsobj.AddProperty("success", reload_skipped_ || !HasReasonsForCancelling());
604 { 603 {
605 JSONObject details(&jsobj, "details"); 604 JSONObject details(&jsobj, "details");
606 if (HasReasonsForCancelling()) { 605 if (reload_skipped_) {
606 // Reload was skipped.
607 const GrowableObjectArray& libs =
608 GrowableObjectArray::Handle(object_store()->libraries());
609 const intptr_t final_library_count = libs.Length();
610 details.AddProperty("savedLibraryCount", final_library_count);
611 details.AddProperty("loadedLibraryCount", static_cast<intptr_t>(0));
612 details.AddProperty("finalLibraryCount", final_library_count);
613 } else if (HasReasonsForCancelling()) {
607 // Reload was rejected. 614 // Reload was rejected.
608 JSONArray array(&jsobj, "notices"); 615 JSONArray array(&jsobj, "notices");
609 for (intptr_t i = 0; i < reasons_to_cancel_reload_.length(); i++) { 616 for (intptr_t i = 0; i < reasons_to_cancel_reload_.length(); i++) {
610 ReasonForCancelling* reason = reasons_to_cancel_reload_.At(i); 617 ReasonForCancelling* reason = reasons_to_cancel_reload_.At(i);
611 reason->AppendTo(&array); 618 reason->AppendTo(&array);
612 } 619 }
613 } else { 620 } else {
614 // Reload was successful. 621 // Reload was successful.
615 const GrowableObjectArray& libs = 622 const GrowableObjectArray& libs =
616 GrowableObjectArray::Handle(object_store()->libraries()); 623 GrowableObjectArray::Handle(object_store()->libraries());
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 ASSERT(!super_cls.IsNull()); 1651 ASSERT(!super_cls.IsNull());
1645 super_cls.AddDirectSubclass(cls); 1652 super_cls.AddDirectSubclass(cls);
1646 } 1653 }
1647 } 1654 }
1648 } 1655 }
1649 } 1656 }
1650 1657
1651 #endif // !PRODUCT 1658 #endif // !PRODUCT
1652 1659
1653 } // namespace dart 1660 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698