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 <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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 isolate_id_(ILLEGAL_PORT) { | 288 isolate_id_(ILLEGAL_PORT) { |
289 } | 289 } |
290 | 290 |
291 | 291 |
292 TimelineEvent::~TimelineEvent() { | 292 TimelineEvent::~TimelineEvent() { |
293 Reset(); | 293 Reset(); |
294 } | 294 } |
295 | 295 |
296 | 296 |
297 void TimelineEvent::Reset() { | 297 void TimelineEvent::Reset() { |
| 298 if (owns_label() && label_ != NULL) { |
| 299 free(const_cast<char*>(label_)); |
| 300 } |
298 state_ = 0; | 301 state_ = 0; |
299 thread_ = OSThread::kInvalidThreadId; | 302 thread_ = OSThread::kInvalidThreadId; |
300 isolate_id_ = ILLEGAL_PORT; | 303 isolate_id_ = ILLEGAL_PORT; |
301 category_ = ""; | 304 category_ = ""; |
302 label_ = NULL; | 305 label_ = NULL; |
303 FreeArguments(); | 306 FreeArguments(); |
304 set_pre_serialized_json(false); | 307 set_pre_serialized_json(false); |
305 set_event_type(kNone); | 308 set_event_type(kNone); |
| 309 set_owns_label(false); |
306 } | 310 } |
307 | 311 |
308 | 312 |
309 void TimelineEvent::AsyncBegin(const char* label, | 313 void TimelineEvent::AsyncBegin(const char* label, |
310 int64_t async_id, | 314 int64_t async_id, |
311 int64_t micros) { | 315 int64_t micros) { |
312 Init(kAsyncBegin, label); | 316 Init(kAsyncBegin, label); |
313 set_timestamp0(micros); | 317 set_timestamp0(micros); |
314 // Overload timestamp1_ with the async_id. | 318 // Overload timestamp1_ with the async_id. |
315 set_timestamp1(async_id); | 319 set_timestamp1(async_id); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 Isolate* isolate = Isolate::Current(); | 499 Isolate* isolate = Isolate::Current(); |
496 if (isolate != NULL) { | 500 if (isolate != NULL) { |
497 isolate_id_ = isolate->main_port(); | 501 isolate_id_ = isolate->main_port(); |
498 } else { | 502 } else { |
499 isolate_id_ = ILLEGAL_PORT; | 503 isolate_id_ = ILLEGAL_PORT; |
500 } | 504 } |
501 label_ = label; | 505 label_ = label; |
502 FreeArguments(); | 506 FreeArguments(); |
503 set_pre_serialized_json(false); | 507 set_pre_serialized_json(false); |
504 set_event_type(event_type); | 508 set_event_type(event_type); |
| 509 set_owns_label(false); |
505 } | 510 } |
506 | 511 |
507 | 512 |
508 bool TimelineEvent::Within(int64_t time_origin_micros, | 513 bool TimelineEvent::Within(int64_t time_origin_micros, |
509 int64_t time_extent_micros) { | 514 int64_t time_extent_micros) { |
510 if ((time_origin_micros == -1) || | 515 if ((time_origin_micros == -1) || |
511 (time_extent_micros == -1)) { | 516 (time_extent_micros == -1)) { |
512 // No time range specified. | 517 // No time range specified. |
513 return true; | 518 return true; |
514 } | 519 } |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 TimelineEventBlock* TimelineEventBlockIterator::Next() { | 1560 TimelineEventBlock* TimelineEventBlockIterator::Next() { |
1556 ASSERT(current_ != NULL); | 1561 ASSERT(current_ != NULL); |
1557 TimelineEventBlock* r = current_; | 1562 TimelineEventBlock* r = current_; |
1558 current_ = current_->next(); | 1563 current_ = current_->next(); |
1559 return r; | 1564 return r; |
1560 } | 1565 } |
1561 | 1566 |
1562 #endif // !PRODUCT | 1567 #endif // !PRODUCT |
1563 | 1568 |
1564 } // namespace dart | 1569 } // namespace dart |
OLD | NEW |