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

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

Issue 584023004: Service isolate rework (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; 1143 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL;
1140 Dart_IsolateUnhandledExceptionCallback 1144 Dart_IsolateUnhandledExceptionCallback
1141 Isolate::unhandled_exception_callback_ = NULL; 1145 Isolate::unhandled_exception_callback_ = NULL;
1142 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; 1146 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL;
1143 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; 1147 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL;
1144 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; 1148 Dart_FileReadCallback Isolate::file_read_callback_ = NULL;
1145 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; 1149 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL;
1146 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; 1150 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL;
1147 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; 1151 Dart_EntropySource Isolate::entropy_source_callback_ = NULL;
1148 Dart_IsolateInterruptCallback Isolate::vmstats_callback_ = NULL; 1152 Dart_IsolateInterruptCallback Isolate::vmstats_callback_ = NULL;
1149 Dart_ServiceIsolateCreateCalback Isolate::service_create_callback_ = NULL;
1150 1153
1151 Monitor* Isolate::isolates_list_monitor_ = NULL; 1154 Monitor* Isolate::isolates_list_monitor_ = NULL;
1152 Isolate* Isolate::isolates_list_head_ = NULL; 1155 Isolate* Isolate::isolates_list_head_ = NULL;
1153 1156
1154 1157
1155 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, 1158 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
1156 bool visit_prologue_weak_handles, 1159 bool visit_prologue_weak_handles,
1157 bool validate_frames) { 1160 bool validate_frames) {
1158 ASSERT(visitor != NULL); 1161 ASSERT(visitor != NULL);
1159 1162
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 serialized_message_, serialized_message_len_); 1649 serialized_message_, serialized_message_len_);
1647 } 1650 }
1648 1651
1649 1652
1650 void IsolateSpawnState::Cleanup() { 1653 void IsolateSpawnState::Cleanup() {
1651 SwitchIsolateScope switch_scope(I); 1654 SwitchIsolateScope switch_scope(I);
1652 Dart::ShutdownIsolate(); 1655 Dart::ShutdownIsolate();
1653 } 1656 }
1654 1657
1655 } // namespace dart 1658 } // namespace dart
OLDNEW
« runtime/include/dart_api.h ('K') | « runtime/vm/isolate.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698