Chromium Code Reviews| Index: runtime/vm/service_event.cc |
| diff --git a/runtime/vm/service_event.cc b/runtime/vm/service_event.cc |
| index 9c9868a933e6e5b484e1711fa3d29fbaea05daac..2811b70ca9195dabb9d20064490dfc23bed2fc2e 100644 |
| --- a/runtime/vm/service_event.cc |
| +++ b/runtime/vm/service_event.cc |
| @@ -4,6 +4,8 @@ |
| #include "vm/service_event.h" |
| +#include "vm/message_handler.h" |
| + |
| namespace dart { |
| // Translate from the legacy DebugEvent to a ServiceEvent. |
| @@ -30,6 +32,31 @@ static ServiceEvent::EventKind TranslateEventKind( |
| } |
| } |
| + |
| +ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind) |
| + : isolate_(isolate), |
| + kind_(event_kind), |
| + embedder_kind_(NULL), |
| + embedder_stream_id_(NULL), |
| + breakpoint_(NULL), |
| + top_frame_(NULL), |
| + exception_(NULL), |
| + async_continuation_(NULL), |
| + at_async_jump_(false), |
| + inspectee_(NULL), |
| + gc_stats_(NULL), |
| + bytes_(NULL), |
| + bytes_length_(0), |
| + timestamp_(-1) { |
| + if ((event_kind == ServiceEvent::kPauseStart) || |
| + (event_kind == ServiceEvent::kPauseExit)) { |
| + timestamp_ = isolate->message_handler()->paused_timestamp(); |
| + } else { |
| + timestamp_ = OS::GetCurrentTimeMillis(); |
| + } |
| +} |
| + |
| + |
| ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) |
| : isolate_(debugger_event->isolate()), |
| kind_(TranslateEventKind(debugger_event->type())), |
| @@ -40,7 +67,8 @@ ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) |
| inspectee_(NULL), |
| gc_stats_(NULL), |
| bytes_(NULL), |
| - bytes_length_(0) { |
| + bytes_length_(0), |
| + timestamp_(-1) { |
| DebuggerEvent::EventType type = debugger_event->type(); |
| if (type == DebuggerEvent::kBreakpointReached) { |
| set_breakpoint(debugger_event->breakpoint()); |
| @@ -55,6 +83,7 @@ ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) |
| type == DebuggerEvent::kExceptionThrown) { |
| set_top_frame(debugger_event->top_frame()); |
| } |
| + timestamp_ = debugger_event->timestamp(); |
|
turnidge
2015/08/25 18:25:31
Let's just use OS::GetCurrentTimeMillis() here too
turnidge
2015/08/25 18:29:03
Nevermind
|
| } |
| @@ -204,6 +233,8 @@ void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const { |
| jsobj->AddProperty("type", "Event"); |
| jsobj->AddProperty("kind", KindAsCString()); |
| jsobj->AddProperty("isolate", isolate()); |
| + ASSERT(timestamp_ != -1); |
| + jsobj->AddPropertyTimeMillis("timestamp", timestamp_); |
| } |
| } // namespace dart |