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

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

Issue 889443002: Service isolate rework take 2 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/service.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 "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 metrics_list_head_(NULL), 547 metrics_list_head_(NULL),
548 next_(NULL), 548 next_(NULL),
549 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) 549 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
550 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) 550 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT)
551 reusable_handles_() { 551 reusable_handles_() {
552 } 552 }
553 #undef REUSABLE_HANDLE_SCOPE_INIT 553 #undef REUSABLE_HANDLE_SCOPE_INIT
554 #undef REUSABLE_HANDLE_INITIALIZERS 554 #undef REUSABLE_HANDLE_INITIALIZERS
555 555
556 Isolate::~Isolate() { 556 Isolate::~Isolate() {
557 delete [] name_; 557 free(name_);
558 delete heap_; 558 delete heap_;
559 delete object_store_; 559 delete object_store_;
560 delete api_state_; 560 delete api_state_;
561 delete stub_code_; 561 delete stub_code_;
562 delete debugger_; 562 delete debugger_;
563 #if defined(USING_SIMULATOR) 563 #if defined(USING_SIMULATOR)
564 delete simulator_; 564 delete simulator_;
565 #endif 565 #endif
566 delete mutex_; 566 delete mutex_;
567 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. 567 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 675
676 return result; 676 return result;
677 } 677 }
678 678
679 679
680 void Isolate::BuildName(const char* name_prefix) { 680 void Isolate::BuildName(const char* name_prefix) {
681 ASSERT(name_ == NULL); 681 ASSERT(name_ == NULL);
682 if (name_prefix == NULL) { 682 if (name_prefix == NULL) {
683 name_prefix = "isolate"; 683 name_prefix = "isolate";
684 } 684 }
685 if (Service::IsServiceIsolateName(name_prefix)) {
686 name_ = strdup(name_prefix);
687 return;
688 }
685 const char* kFormat = "%s-%lld"; 689 const char* kFormat = "%s-%lld";
686 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1; 690 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1;
687 name_ = new char[len]; 691 name_ = reinterpret_cast<char*>(malloc(len));
688 OS::SNPrint(name_, len, kFormat, name_prefix, main_port()); 692 OS::SNPrint(name_, len, kFormat, name_prefix, main_port());
689 } 693 }
690 694
691 695
692 // TODO(5411455): Use flag to override default value and Validate the 696 // TODO(5411455): Use flag to override default value and Validate the
693 // stack size by querying OS. 697 // stack size by querying OS.
694 uword Isolate::GetSpecifiedStackSize() { 698 uword Isolate::GetSpecifiedStackSize() {
695 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); 699 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize());
696 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; 700 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer;
697 return stack_size; 701 return stack_size;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; 1140 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL;
1137 Dart_IsolateUnhandledExceptionCallback 1141 Dart_IsolateUnhandledExceptionCallback
1138 Isolate::unhandled_exception_callback_ = NULL; 1142 Isolate::unhandled_exception_callback_ = NULL;
1139 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; 1143 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL;
1140 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; 1144 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL;
1141 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; 1145 Dart_FileReadCallback Isolate::file_read_callback_ = NULL;
1142 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; 1146 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL;
1143 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; 1147 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL;
1144 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; 1148 Dart_EntropySource Isolate::entropy_source_callback_ = NULL;
1145 Dart_IsolateInterruptCallback Isolate::vmstats_callback_ = NULL; 1149 Dart_IsolateInterruptCallback Isolate::vmstats_callback_ = NULL;
1146 Dart_ServiceIsolateCreateCalback Isolate::service_create_callback_ = NULL;
1147 1150
1148 Monitor* Isolate::isolates_list_monitor_ = NULL; 1151 Monitor* Isolate::isolates_list_monitor_ = NULL;
1149 Isolate* Isolate::isolates_list_head_ = NULL; 1152 Isolate* Isolate::isolates_list_head_ = NULL;
1150 1153
1151 1154
1152 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, 1155 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
1153 bool visit_prologue_weak_handles, 1156 bool visit_prologue_weak_handles,
1154 bool validate_frames) { 1157 bool validate_frames) {
1155 ASSERT(visitor != NULL); 1158 ASSERT(visitor != NULL);
1156 1159
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 serialized_message_, serialized_message_len_); 1646 serialized_message_, serialized_message_len_);
1644 } 1647 }
1645 1648
1646 1649
1647 void IsolateSpawnState::Cleanup() { 1650 void IsolateSpawnState::Cleanup() {
1648 SwitchIsolateScope switch_scope(I); 1651 SwitchIsolateScope switch_scope(I);
1649 Dart::ShutdownIsolate(); 1652 Dart::ShutdownIsolate();
1650 } 1653 }
1651 1654
1652 } // namespace dart 1655 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698