OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_event.h" | 5 #include "vm/service_event.h" |
6 | 6 |
7 #include "vm/debugger.h" | 7 #include "vm/debugger.h" |
8 #include "vm/message_handler.h" | 8 #include "vm/message_handler.h" |
9 #include "vm/service_isolate.h" | 9 #include "vm/service_isolate.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 inspectee_(NULL), | 29 inspectee_(NULL), |
30 gc_stats_(NULL), | 30 gc_stats_(NULL), |
31 bytes_(NULL), | 31 bytes_(NULL), |
32 bytes_length_(0), | 32 bytes_length_(0), |
33 timestamp_(OS::GetCurrentTimeMillis()) { | 33 timestamp_(OS::GetCurrentTimeMillis()) { |
34 // We should never generate events for the vm or service isolates. | 34 // We should never generate events for the vm or service isolates. |
35 ASSERT(isolate_ != Dart::vm_isolate()); | 35 ASSERT(isolate_ != Dart::vm_isolate()); |
36 ASSERT(isolate == NULL || | 36 ASSERT(isolate == NULL || |
37 !ServiceIsolate::IsServiceIsolateDescendant(isolate_)); | 37 !ServiceIsolate::IsServiceIsolateDescendant(isolate_)); |
38 | 38 |
39 if ((event_kind == ServiceEvent::kPauseStart) && | 39 if ((event_kind == ServiceEvent::kPauseStart) || |
40 !isolate->message_handler()->is_paused_on_start()) { | 40 (event_kind == ServiceEvent::kPauseExit)) { |
41 // We will pause on start but the message handler lacks a valid | |
42 // paused timestamp because we haven't paused yet. Use the current time. | |
43 timestamp_ = OS::GetCurrentTimeMillis(); | |
44 } else if ((event_kind == ServiceEvent::kPauseStart) || | |
45 (event_kind == ServiceEvent::kPauseExit)) { | |
46 timestamp_ = isolate->message_handler()->paused_timestamp(); | 41 timestamp_ = isolate->message_handler()->paused_timestamp(); |
47 } else if (event_kind == ServiceEvent::kResume) { | 42 } else if (event_kind == ServiceEvent::kResume) { |
48 timestamp_ = isolate->last_resume_timestamp(); | 43 timestamp_ = isolate->last_resume_timestamp(); |
49 } | 44 } |
| 45 ASSERT(timestamp_ > -1); |
50 } | 46 } |
51 | 47 |
52 void ServiceEvent::UpdateTimestamp() { | 48 void ServiceEvent::UpdateTimestamp() { |
53 timestamp_ = OS::GetCurrentTimeMillis(); | 49 timestamp_ = OS::GetCurrentTimeMillis(); |
54 } | 50 } |
55 | 51 |
56 const char* ServiceEvent::KindAsCString() const { | 52 const char* ServiceEvent::KindAsCString() const { |
57 switch (kind()) { | 53 switch (kind()) { |
58 case kVMUpdate: | 54 case kVMUpdate: |
59 return "VMUpdate"; | 55 return "VMUpdate"; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } else { | 269 } else { |
274 jsobj->AddProperty("isolate", isolate()); | 270 jsobj->AddProperty("isolate", isolate()); |
275 } | 271 } |
276 ASSERT(timestamp_ != -1); | 272 ASSERT(timestamp_ != -1); |
277 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); | 273 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); |
278 } | 274 } |
279 | 275 |
280 #endif // !PRODUCT | 276 #endif // !PRODUCT |
281 | 277 |
282 } // namespace dart | 278 } // namespace dart |
OLD | NEW |