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

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

Issue 1402203003: Fix racey crash in TimelineDurationScope (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 Init(); 504 Init();
505 } 505 }
506 506
507 507
508 TimelineDurationScope::~TimelineDurationScope() { 508 TimelineDurationScope::~TimelineDurationScope() {
509 if (!enabled_) { 509 if (!enabled_) {
510 FreeArguments(); 510 FreeArguments();
511 return; 511 return;
512 } 512 }
513 TimelineEvent* event = stream_->StartEvent(); 513 TimelineEvent* event = stream_->StartEvent();
514 if (event == NULL) {
515 // Stream is now disabled.
516 FreeArguments();
517 return;
518 }
514 ASSERT(event != NULL); 519 ASSERT(event != NULL);
515 event->Duration(label_, timestamp_, OS::GetCurrentTraceMicros()); 520 event->Duration(label_, timestamp_, OS::GetCurrentTraceMicros());
516 event->StealArguments(arguments_length_, arguments_); 521 event->StealArguments(arguments_length_, arguments_);
517 event->Complete(); 522 event->Complete();
518 arguments_length_ = 0; 523 arguments_length_ = 0;
519 arguments_ = NULL; 524 arguments_ = NULL;
520 } 525 }
521 526
522 527
523 void TimelineDurationScope::Init() { 528 void TimelineDurationScope::Init() {
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 // If an isolate was specified, skip events from other isolates. 1467 // If an isolate was specified, skip events from other isolates.
1463 continue; 1468 continue;
1464 } 1469 }
1465 ASSERT(event->event_as_json() != NULL); 1470 ASSERT(event->event_as_json() != NULL);
1466 result = zone->ConcatStrings(result, event->event_as_json()); 1471 result = zone->ConcatStrings(result, event->event_as_json());
1467 } 1472 }
1468 return result; 1473 return result;
1469 } 1474 }
1470 1475
1471 } // namespace dart 1476 } // 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