| 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 "include/dart_native_api.h" | 5 #include "include/dart_native_api.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_api_message.h" | 9 #include "vm/dart_api_message.h" |
| 10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 return reinterpret_cast<uint8_t*>(new_ptr); | 21 return reinterpret_cast<uint8_t*>(new_ptr); |
| 22 } | 22 } |
| 23 | 23 |
| 24 | 24 |
| 25 class IsolateSaver { | 25 class IsolateSaver { |
| 26 public: | 26 public: |
| 27 explicit IsolateSaver(Isolate* current_isolate) | 27 explicit IsolateSaver(Isolate* current_isolate) |
| 28 : saved_isolate_(current_isolate) { | 28 : saved_isolate_(current_isolate) { |
| 29 if (current_isolate != NULL) { | 29 if (current_isolate != NULL) { |
| 30 ASSERT(current_isolate == Isolate::Current()); | 30 ASSERT(current_isolate == Isolate::Current()); |
| 31 Thread::ExitIsolate(); | 31 Dart_ExitIsolate(); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 ~IsolateSaver() { | 34 ~IsolateSaver() { |
| 35 if (saved_isolate_ != NULL) { | 35 if (saved_isolate_ != NULL) { |
| 36 Thread::EnterIsolate(saved_isolate_); | 36 Dart_Isolate I = reinterpret_cast<Dart_Isolate>(saved_isolate_); |
| 37 Dart_EnterIsolate(I); |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 private: | 40 private: |
| 40 Isolate* saved_isolate_; | 41 Isolate* saved_isolate_; |
| 41 | 42 |
| 42 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); | 43 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 | 46 |
| 46 static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject* message) { | 47 static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject* message) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); | 122 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); |
| 122 if (::Dart_IsError(result)) { | 123 if (::Dart_IsError(result)) { |
| 123 return result; | 124 return result; |
| 124 } | 125 } |
| 125 CHECK_CALLBACK_STATE(T); | 126 CHECK_CALLBACK_STATE(T); |
| 126 CompileAll(T, &result); | 127 CompileAll(T, &result); |
| 127 return result; | 128 return result; |
| 128 } | 129 } |
| 129 | 130 |
| 130 } // namespace dart | 131 } // namespace dart |
| OLD | NEW |