OLD | NEW |
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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 debugger()->Shutdown(); | 1609 debugger()->Shutdown(); |
1610 | 1610 |
1611 // Close all the ports owned by this isolate. | 1611 // Close all the ports owned by this isolate. |
1612 PortMap::ClosePorts(message_handler()); | 1612 PortMap::ClosePorts(message_handler()); |
1613 | 1613 |
1614 // Fail fast if anybody tries to post any more messsages to this isolate. | 1614 // Fail fast if anybody tries to post any more messsages to this isolate. |
1615 delete message_handler(); | 1615 delete message_handler(); |
1616 set_message_handler(NULL); | 1616 set_message_handler(NULL); |
1617 | 1617 |
1618 // Before analyzing the isolate's timeline blocks- reclaim all cached blocks. | 1618 // Before analyzing the isolate's timeline blocks- reclaim all cached blocks. |
1619 ReclaimTimelineBlocks(); | 1619 Timeline::ReclaimCachedBlocksFromThreads(); |
1620 | 1620 |
1621 // Dump all timing data for the isolate. | 1621 // Dump all timing data for the isolate. |
1622 if (FLAG_timing) { | 1622 if (FLAG_timing) { |
1623 TimelinePauseTrace tpt; | 1623 TimelinePauseTrace tpt; |
1624 tpt.Print(); | 1624 tpt.Print(); |
1625 } | 1625 } |
1626 | 1626 |
1627 // Finalize any weak persistent handles with a non-null referent. | 1627 // Finalize any weak persistent handles with a non-null referent. |
1628 FinalizeWeakPersistentHandlesVisitor visitor; | 1628 FinalizeWeakPersistentHandlesVisitor visitor; |
1629 api_state()->weak_persistent_handles().VisitHandles(&visitor); | 1629 api_state()->weak_persistent_handles().VisitHandles(&visitor); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 | 1711 |
1712 // TODO(5411455): For now just make sure there are no current isolates | 1712 // TODO(5411455): For now just make sure there are no current isolates |
1713 // as we are shutting down the isolate. | 1713 // as we are shutting down the isolate. |
1714 Thread::ExitIsolate(); | 1714 Thread::ExitIsolate(); |
1715 // All threads should have exited by now. | 1715 // All threads should have exited by now. |
1716 thread_registry()->CheckNotScheduled(this); | 1716 thread_registry()->CheckNotScheduled(this); |
1717 Profiler::ShutdownProfilingForIsolate(this); | 1717 Profiler::ShutdownProfilingForIsolate(this); |
1718 } | 1718 } |
1719 | 1719 |
1720 | 1720 |
1721 void Isolate::ReclaimTimelineBlocks() { | |
1722 TimelineEventRecorder* recorder = Timeline::recorder(); | |
1723 if (recorder == NULL) { | |
1724 return; | |
1725 } | |
1726 thread_registry_->ReclaimTimelineBlocks(); | |
1727 } | |
1728 | |
1729 | |
1730 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 1721 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
1731 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; | 1722 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; |
1732 Dart_IsolateUnhandledExceptionCallback | 1723 Dart_IsolateUnhandledExceptionCallback |
1733 Isolate::unhandled_exception_callback_ = NULL; | 1724 Isolate::unhandled_exception_callback_ = NULL; |
1734 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 1725 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
1735 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; | 1726 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; |
1736 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; | 1727 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; |
1737 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; | 1728 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; |
1738 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; | 1729 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; |
1739 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; | 1730 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 serialized_message_, serialized_message_len_); | 2603 serialized_message_, serialized_message_len_); |
2613 } | 2604 } |
2614 | 2605 |
2615 | 2606 |
2616 void IsolateSpawnState::Cleanup() { | 2607 void IsolateSpawnState::Cleanup() { |
2617 SwitchIsolateScope switch_scope(I); | 2608 SwitchIsolateScope switch_scope(I); |
2618 Dart::ShutdownIsolate(); | 2609 Dart::ShutdownIsolate(); |
2619 } | 2610 } |
2620 | 2611 |
2621 } // namespace dart | 2612 } // namespace dart |
OLD | NEW |