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

Unified Diff: runtime/vm/isolate_reload.cc

Issue 2186303002: Added JSON reporting to reload. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate_reload.h ('k') | runtime/vm/object_reload.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate_reload.cc
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 158f6554921d899f059b21deeb932de42515485f..b23dd3b08679685353997f50289ded42903c44cf 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -162,6 +162,20 @@ void InstanceMorpher::Dump() const {
}
+void InstanceMorpher::AppendTo(JSONArray* array) {
+ JSONObject jsobj(array);
+ jsobj.AddProperty("type", "Morpher");
+ jsobj.AddProperty("class", to_);
+ jsobj.AddProperty("instances", before()->length());
+ JSONArray map(&jsobj, "mapping");
+ for (int i = 0; i < mapping_.length(); i += 2) {
+ JSONArray pair(&map);
+ pair.AddValue(mapping_.At(i));
+ pair.AddValue(mapping_.At(i+1));
+ }
+}
+
+
void ReasonForCancelling::Report(IsolateReloadContext* context) {
const Error& error = Error::Handle(ToError());
context->ReportError(error);
@@ -181,6 +195,22 @@ RawString* ReasonForCancelling::ToString() {
}
+void ReasonForCancelling::AppendTo(JSONArray* array) {
+ JSONObject jsobj(array);
+ jsobj.AddProperty("type", "ReasonForCancelling");
+ const String& message = String::Handle(ToString());
+ jsobj.AddProperty("message", message);
+}
+
+
+void ClassReasonForCancelling::AppendTo(JSONArray* array) {
+ JSONObject jsobj(array);
+ jsobj.AddProperty("type", "ReasonForCancelling");
+ jsobj.AddProperty("class", from_);
+ const String& message = String::Handle(ToString());
+ jsobj.AddProperty("message", message);
+}
+
RawError* IsolateReloadContext::error() const {
ASSERT(has_error());
// Report the first error to the surroundings.
@@ -190,6 +220,7 @@ RawError* IsolateReloadContext::error() const {
return error.raw();
}
+
class ScriptUrlSetTraits {
public:
static bool ReportStats() { return false; }
@@ -490,6 +521,31 @@ void IsolateReloadContext::FinishReload() {
}
BackgroundCompiler::Enable();
+
+ if (FLAG_trace_reload) {
+ JSONStream stream;
+ ReportOnJSON(&stream);
+ OS::Print("\nJSON report:\n %s\n", stream.ToCString());
+ }
+}
+
+
+void IsolateReloadContext::ReportOnJSON(JSONStream* stream) {
+ JSONObject jsobj(stream);
+ jsobj.AddProperty("type", "Reload");
+ jsobj.AddProperty("succeeded", !HasReasonsForCancelling());
+ if (HasReasonsForCancelling()) {
+ JSONArray array(&jsobj, "reasons");
+ for (intptr_t i = 0; i < reasons_to_cancel_reload_.length(); i++) {
+ ReasonForCancelling* reason = reasons_to_cancel_reload_.At(i);
+ reason->AppendTo(&array);
+ }
+ } else {
+ JSONArray array(&jsobj, "changes");
+ for (intptr_t i = 0; i < instance_morphers_.length(); i++) {
+ instance_morphers_.At(i)->AppendTo(&array);
+ }
+ }
}
« no previous file with comments | « runtime/vm/isolate_reload.h ('k') | runtime/vm/object_reload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698