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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 state_ = 0; | 298 state_ = 0; |
299 thread_ = OSThread::kInvalidThreadId; | 299 thread_ = OSThread::kInvalidThreadId; |
300 isolate_id_ = ILLEGAL_PORT; | 300 isolate_id_ = ILLEGAL_PORT; |
301 category_ = ""; | 301 category_ = ""; |
302 label_ = NULL; | 302 if (label_ != NULL) { |
303 free(label_); | |
304 label_ = NULL; | |
305 } | |
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); |
306 } | 309 } |
307 | 310 |
308 | 311 |
309 void TimelineEvent::AsyncBegin(const char* label, | 312 void TimelineEvent::AsyncBegin(const char* label, |
310 int64_t async_id, | 313 int64_t async_id, |
311 int64_t micros) { | 314 int64_t micros) { |
312 Init(kAsyncBegin, label); | 315 Init(kAsyncBegin, label); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 timestamp1_ = 0; | 494 timestamp1_ = 0; |
492 OSThread* os_thread = OSThread::Current(); | 495 OSThread* os_thread = OSThread::Current(); |
493 ASSERT(os_thread != NULL); | 496 ASSERT(os_thread != NULL); |
494 thread_ = os_thread->trace_id(); | 497 thread_ = os_thread->trace_id(); |
495 Isolate* isolate = Isolate::Current(); | 498 Isolate* isolate = Isolate::Current(); |
496 if (isolate != NULL) { | 499 if (isolate != NULL) { |
497 isolate_id_ = isolate->main_port(); | 500 isolate_id_ = isolate->main_port(); |
498 } else { | 501 } else { |
499 isolate_id_ = ILLEGAL_PORT; | 502 isolate_id_ = ILLEGAL_PORT; |
500 } | 503 } |
501 label_ = label; | 504 label_ = strdup(label); |
Cutch
2016/04/14 13:24:29
The timeline was designed to require const char* f
| |
502 FreeArguments(); | 505 FreeArguments(); |
503 set_pre_serialized_json(false); | 506 set_pre_serialized_json(false); |
504 set_event_type(event_type); | 507 set_event_type(event_type); |
505 } | 508 } |
506 | 509 |
507 | 510 |
508 bool TimelineEvent::Within(int64_t time_origin_micros, | 511 bool TimelineEvent::Within(int64_t time_origin_micros, |
509 int64_t time_extent_micros) { | 512 int64_t time_extent_micros) { |
510 if ((time_origin_micros == -1) || | 513 if ((time_origin_micros == -1) || |
511 (time_extent_micros == -1)) { | 514 (time_extent_micros == -1)) { |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1555 TimelineEventBlock* TimelineEventBlockIterator::Next() { | 1558 TimelineEventBlock* TimelineEventBlockIterator::Next() { |
1556 ASSERT(current_ != NULL); | 1559 ASSERT(current_ != NULL); |
1557 TimelineEventBlock* r = current_; | 1560 TimelineEventBlock* r = current_; |
1558 current_ = current_->next(); | 1561 current_ = current_->next(); |
1559 return r; | 1562 return r; |
1560 } | 1563 } |
1561 | 1564 |
1562 #endif // !PRODUCT | 1565 #endif // !PRODUCT |
1563 | 1566 |
1564 } // namespace dart | 1567 } // namespace dart |
OLD | NEW |