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

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
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/thread.h » ('j') | 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) 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 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 // Close all the ports owned by this isolate. 1593 // Close all the ports owned by this isolate.
1594 PortMap::ClosePorts(message_handler()); 1594 PortMap::ClosePorts(message_handler());
1595 1595
1596 // Fail fast if anybody tries to post any more messsages to this isolate. 1596 // Fail fast if anybody tries to post any more messsages to this isolate.
1597 delete message_handler(); 1597 delete message_handler();
1598 set_message_handler(NULL); 1598 set_message_handler(NULL);
1599 1599
1600 // Dump all accumulated timer data for the isolate. 1600 // Dump all accumulated timer data for the isolate.
1601 timer_list_.ReportTimers(); 1601 timer_list_.ReportTimers();
1602 1602
1603 // Before analyzing the isolate's timeline blocks- close all of them. 1603 // Before analyzing the isolate's timeline blocks- reclaim all cached blocks.
1604 CloseAllTimelineBlocks(); 1604 ReclaimTimelineBlocks();
1605 1605
1606 // Dump all timing data for the isolate. 1606 // Dump all timing data for the isolate.
1607 if (FLAG_timing) { 1607 if (FLAG_timing) {
1608 TimelinePauseTrace tpt; 1608 TimelinePauseTrace tpt;
1609 tpt.Print(); 1609 tpt.Print();
1610 } 1610 }
1611 1611
1612 // Finalize any weak persistent handles with a non-null referent. 1612 // Finalize any weak persistent handles with a non-null referent.
1613 FinalizeWeakPersistentHandlesVisitor visitor; 1613 FinalizeWeakPersistentHandlesVisitor visitor;
1614 api_state()->weak_persistent_handles().VisitHandles(&visitor); 1614 api_state()->weak_persistent_handles().VisitHandles(&visitor);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 1694
1695 // TODO(5411455): For now just make sure there are no current isolates 1695 // TODO(5411455): For now just make sure there are no current isolates
1696 // as we are shutting down the isolate. 1696 // as we are shutting down the isolate.
1697 Thread::ExitIsolate(); 1697 Thread::ExitIsolate();
1698 // All threads should have exited by now. 1698 // All threads should have exited by now.
1699 thread_registry()->CheckNotScheduled(this); 1699 thread_registry()->CheckNotScheduled(this);
1700 Profiler::ShutdownProfilingForIsolate(this); 1700 Profiler::ShutdownProfilingForIsolate(this);
1701 } 1701 }
1702 1702
1703 1703
1704 void Isolate::CloseAllTimelineBlocks() { 1704 void Isolate::ReclaimTimelineBlocks() {
1705 // Close all blocks
1706 thread_registry_->CloseAllTimelineBlocks();
1707 TimelineEventRecorder* recorder = Timeline::recorder(); 1705 TimelineEventRecorder* recorder = Timeline::recorder();
1708 if (recorder != NULL) { 1706 if (recorder == NULL) {
1709 MutexLocker ml(&recorder->lock_); 1707 return;
1710 Thread::Current()->CloseTimelineBlock();
1711 } 1708 }
1709 thread_registry_->ReclaimTimelineBlocks();
1712 } 1710 }
1713 1711
1714 1712
1715 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; 1713 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL;
1716 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; 1714 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL;
1717 Dart_IsolateUnhandledExceptionCallback 1715 Dart_IsolateUnhandledExceptionCallback
1718 Isolate::unhandled_exception_callback_ = NULL; 1716 Isolate::unhandled_exception_callback_ = NULL;
1719 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; 1717 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL;
1720 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; 1718 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL;
1721 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; 1719 Dart_FileReadCallback Isolate::file_read_callback_ = NULL;
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 serialized_message_, serialized_message_len_); 2577 serialized_message_, serialized_message_len_);
2580 } 2578 }
2581 2579
2582 2580
2583 void IsolateSpawnState::Cleanup() { 2581 void IsolateSpawnState::Cleanup() {
2584 SwitchIsolateScope switch_scope(I); 2582 SwitchIsolateScope switch_scope(I);
2585 Dart::ShutdownIsolate(); 2583 Dart::ShutdownIsolate();
2586 } 2584 }
2587 2585
2588 } // namespace dart 2586 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698