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

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

Issue 1644023003: Fix Timeline reporting crash when reusing timeline events with preserialized json (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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) 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 <cstdlib> 5 #include <cstdlib>
6 6
7 #include "vm/atomic.h" 7 #include "vm/atomic.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/json_stream.h" 9 #include "vm/json_stream.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 isolate_id_(ILLEGAL_PORT) { 183 isolate_id_(ILLEGAL_PORT) {
184 } 184 }
185 185
186 186
187 TimelineEvent::~TimelineEvent() { 187 TimelineEvent::~TimelineEvent() {
188 Reset(); 188 Reset();
189 } 189 }
190 190
191 191
192 void TimelineEvent::Reset() { 192 void TimelineEvent::Reset() {
193 set_event_type(kNone); 193 state_ = 0;
194 thread_ = OSThread::kInvalidThreadId; 194 thread_ = OSThread::kInvalidThreadId;
195 isolate_id_ = ILLEGAL_PORT; 195 isolate_id_ = ILLEGAL_PORT;
196 category_ = ""; 196 category_ = "";
197 label_ = NULL; 197 label_ = NULL;
198 FreeArguments(); 198 FreeArguments();
199 set_pre_serialized_json(false);
200 set_event_type(kNone);
199 } 201 }
200 202
201 203
202 void TimelineEvent::AsyncBegin(const char* label, 204 void TimelineEvent::AsyncBegin(const char* label,
203 int64_t async_id, 205 int64_t async_id,
204 int64_t micros) { 206 int64_t micros) {
205 Init(kAsyncBegin, label); 207 Init(kAsyncBegin, label);
206 set_timestamp0(micros); 208 set_timestamp0(micros);
207 // Overload timestamp1_ with the async_id. 209 // Overload timestamp1_ with the async_id.
208 set_timestamp1(async_id); 210 set_timestamp1(async_id);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 category_ = stream->name(); 362 category_ = stream->name();
361 } else { 363 } else {
362 category_ = ""; 364 category_ = "";
363 } 365 }
364 } 366 }
365 367
366 368
367 void TimelineEvent::Init(EventType event_type, 369 void TimelineEvent::Init(EventType event_type,
368 const char* label) { 370 const char* label) {
369 ASSERT(label != NULL); 371 ASSERT(label != NULL);
370 set_event_type(event_type); 372 state_ = 0;
371 timestamp0_ = 0; 373 timestamp0_ = 0;
372 timestamp1_ = 0; 374 timestamp1_ = 0;
373 OSThread* os_thread = OSThread::Current(); 375 OSThread* os_thread = OSThread::Current();
374 ASSERT(os_thread != NULL); 376 ASSERT(os_thread != NULL);
375 thread_ = os_thread->trace_id(); 377 thread_ = os_thread->trace_id();
376 Isolate* isolate = Isolate::Current(); 378 Isolate* isolate = Isolate::Current();
377 if (isolate != NULL) { 379 if (isolate != NULL) {
378 isolate_id_ = isolate->main_port(); 380 isolate_id_ = isolate->main_port();
379 } else { 381 } else {
380 isolate_id_ = ILLEGAL_PORT; 382 isolate_id_ = ILLEGAL_PORT;
381 } 383 }
382 label_ = label; 384 label_ = label;
383 FreeArguments(); 385 FreeArguments();
386 set_pre_serialized_json(false);
387 set_event_type(event_type);
384 } 388 }
385 389
386 390
387 bool TimelineEvent::Within(int64_t time_origin_micros, 391 bool TimelineEvent::Within(int64_t time_origin_micros,
388 int64_t time_extent_micros) { 392 int64_t time_extent_micros) {
389 if ((time_origin_micros == -1) || 393 if ((time_origin_micros == -1) ||
390 (time_extent_micros == -1)) { 394 (time_extent_micros == -1)) {
391 // No time range specified. 395 // No time range specified.
392 return true; 396 return true;
393 } 397 }
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 1322
1319 1323
1320 TimelineEventBlock* TimelineEventBlockIterator::Next() { 1324 TimelineEventBlock* TimelineEventBlockIterator::Next() {
1321 ASSERT(current_ != NULL); 1325 ASSERT(current_ != NULL);
1322 TimelineEventBlock* r = current_; 1326 TimelineEventBlock* r = current_;
1323 current_ = current_->next(); 1327 current_ = current_->next();
1324 return r; 1328 return r;
1325 } 1329 }
1326 1330
1327 } // namespace dart 1331 } // 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