| 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 #ifndef VM_ISOLATE_H_ | 5 #ifndef VM_ISOLATE_H_ |
| 6 #define VM_ISOLATE_H_ | 6 #define VM_ISOLATE_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/base_isolate.h" | 10 #include "vm/base_isolate.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 DISALLOW_COPY_AND_ASSIGN(Isolate); | 755 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 756 }; | 756 }; |
| 757 | 757 |
| 758 | 758 |
| 759 // When we need to execute code in an isolate, we use the | 759 // When we need to execute code in an isolate, we use the |
| 760 // StartIsolateScope. | 760 // StartIsolateScope. |
| 761 class StartIsolateScope { | 761 class StartIsolateScope { |
| 762 public: | 762 public: |
| 763 explicit StartIsolateScope(Isolate* new_isolate) | 763 explicit StartIsolateScope(Isolate* new_isolate) |
| 764 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { | 764 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { |
| 765 ASSERT(new_isolate_ != NULL); | 765 if (new_isolate_ == NULL) { |
| 766 // Do nothing. |
| 767 return; |
| 768 } |
| 766 if (saved_isolate_ != new_isolate_) { | 769 if (saved_isolate_ != new_isolate_) { |
| 767 ASSERT(Isolate::Current() == NULL); | 770 ASSERT(Isolate::Current() == NULL); |
| 768 Isolate::SetCurrent(new_isolate_); | 771 Isolate::SetCurrent(new_isolate_); |
| 769 new_isolate_->SetStackLimitFromStackBase(reinterpret_cast<uword>(this)); | 772 new_isolate_->SetStackLimitFromStackBase(reinterpret_cast<uword>(this)); |
| 770 } | 773 } |
| 771 } | 774 } |
| 772 | 775 |
| 773 ~StartIsolateScope() { | 776 ~StartIsolateScope() { |
| 777 if (new_isolate_ == NULL) { |
| 778 // Do nothing. |
| 779 return; |
| 780 } |
| 774 if (saved_isolate_ != new_isolate_) { | 781 if (saved_isolate_ != new_isolate_) { |
| 775 new_isolate_->ClearStackLimit(); | 782 new_isolate_->ClearStackLimit(); |
| 776 Isolate::SetCurrent(saved_isolate_); | 783 Isolate::SetCurrent(saved_isolate_); |
| 777 } | 784 } |
| 778 } | 785 } |
| 779 | 786 |
| 780 private: | 787 private: |
| 781 Isolate* new_isolate_; | 788 Isolate* new_isolate_; |
| 782 Isolate* saved_isolate_; | 789 Isolate* saved_isolate_; |
| 783 | 790 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 uint8_t* serialized_args_; | 870 uint8_t* serialized_args_; |
| 864 intptr_t serialized_args_len_; | 871 intptr_t serialized_args_len_; |
| 865 uint8_t* serialized_message_; | 872 uint8_t* serialized_message_; |
| 866 intptr_t serialized_message_len_; | 873 intptr_t serialized_message_len_; |
| 867 bool paused_; | 874 bool paused_; |
| 868 }; | 875 }; |
| 869 | 876 |
| 870 } // namespace dart | 877 } // namespace dart |
| 871 | 878 |
| 872 #endif // VM_ISOLATE_H_ | 879 #endif // VM_ISOLATE_H_ |
| OLD | NEW |