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

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

Issue 3006883002: Make service protocol respect isolate lifecycle (Closed)
Patch Set: Merged with upstream Created 3 years, 3 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 | « runtime/vm/message_handler.cc ('k') | 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) 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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698