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

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

Issue 1363033003: Make TimelineEventBlocks reclaimable (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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/json.h" 10 #include "platform/json.h"
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 // Close all the ports owned by this isolate. 1508 // Close all the ports owned by this isolate.
1509 PortMap::ClosePorts(message_handler()); 1509 PortMap::ClosePorts(message_handler());
1510 1510
1511 // Fail fast if anybody tries to post any more messsages to this isolate. 1511 // Fail fast if anybody tries to post any more messsages to this isolate.
1512 delete message_handler(); 1512 delete message_handler();
1513 set_message_handler(NULL); 1513 set_message_handler(NULL);
1514 1514
1515 // Dump all accumulated timer data for the isolate. 1515 // Dump all accumulated timer data for the isolate.
1516 timer_list_.ReportTimers(); 1516 timer_list_.ReportTimers();
1517 1517
1518 // Before analyzing the isolate's timeline blocks- close all of them. 1518 // Before analyzing the isolate's timeline blocks- reclaim all cached blocks.
1519 CloseAllTimelineBlocks(); 1519 ReclaimTimelineBlocks();
1520 1520
1521 // Dump all timing data for the isolate. 1521 // Dump all timing data for the isolate.
1522 if (FLAG_timing) { 1522 if (FLAG_timing) {
1523 TimelinePauseTrace tpt; 1523 TimelinePauseTrace tpt;
1524 tpt.Print(); 1524 tpt.Print();
1525 } 1525 }
1526 1526
1527 // Finalize any weak persistent handles with a non-null referent. 1527 // Finalize any weak persistent handles with a non-null referent.
1528 FinalizeWeakPersistentHandlesVisitor visitor; 1528 FinalizeWeakPersistentHandlesVisitor visitor;
1529 api_state()->weak_persistent_handles().VisitHandles(&visitor); 1529 api_state()->weak_persistent_handles().VisitHandles(&visitor);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 1609
1610 // TODO(5411455): For now just make sure there are no current isolates 1610 // TODO(5411455): For now just make sure there are no current isolates
1611 // as we are shutting down the isolate. 1611 // as we are shutting down the isolate.
1612 Thread::ExitIsolate(); 1612 Thread::ExitIsolate();
1613 // All threads should have exited by now. 1613 // All threads should have exited by now.
1614 thread_registry()->CheckNotScheduled(this); 1614 thread_registry()->CheckNotScheduled(this);
1615 Profiler::ShutdownProfilingForIsolate(this); 1615 Profiler::ShutdownProfilingForIsolate(this);
1616 } 1616 }
1617 1617
1618 1618
1619 void Isolate::CloseAllTimelineBlocks() { 1619 void Isolate::ReclaimTimelineBlocks() {
1620 // Close all blocks
1621 thread_registry_->CloseAllTimelineBlocks();
1622 TimelineEventRecorder* recorder = Timeline::recorder(); 1620 TimelineEventRecorder* recorder = Timeline::recorder();
1623 if (recorder != NULL) { 1621 if (recorder == NULL) {
1624 MutexLocker ml(&recorder->lock_); 1622 return;
1625 Thread::Current()->CloseTimelineBlock();
1626 } 1623 }
1624 thread_registry_->ReclaimTimelineBlocks();
1627 } 1625 }
1628 1626
1629 1627
1630 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; 1628 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL;
1631 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; 1629 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL;
1632 Dart_IsolateUnhandledExceptionCallback 1630 Dart_IsolateUnhandledExceptionCallback
1633 Isolate::unhandled_exception_callback_ = NULL; 1631 Isolate::unhandled_exception_callback_ = NULL;
1634 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; 1632 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL;
1635 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; 1633 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL;
1636 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; 1634 Dart_FileReadCallback Isolate::file_read_callback_ = NULL;
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 serialized_message_, serialized_message_len_); 2492 serialized_message_, serialized_message_len_);
2495 } 2493 }
2496 2494
2497 2495
2498 void IsolateSpawnState::Cleanup() { 2496 void IsolateSpawnState::Cleanup() {
2499 SwitchIsolateScope switch_scope(I); 2497 SwitchIsolateScope switch_scope(I);
2500 Dart::ShutdownIsolate(); 2498 Dart::ShutdownIsolate();
2501 } 2499 }
2502 2500
2503 } // namespace dart 2501 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/thread.h » ('j') | runtime/vm/thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698