OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SKY_TOOLS_PACKAGER_SCOPE_H_ |
| 6 #define SKY_TOOLS_PACKAGER_SCOPE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/logging.h" |
| 10 #include "dart/runtime/include/dart_api.h" |
| 11 |
| 12 class DartIsolateScope { |
| 13 public: |
| 14 explicit DartIsolateScope(Dart_Isolate isolate) { |
| 15 CHECK(!Dart_CurrentIsolate()); |
| 16 Dart_EnterIsolate(isolate); |
| 17 } |
| 18 ~DartIsolateScope() { Dart_ExitIsolate(); } |
| 19 |
| 20 private: |
| 21 DISALLOW_COPY_AND_ASSIGN(DartIsolateScope); |
| 22 }; |
| 23 |
| 24 class DartApiScope { |
| 25 public: |
| 26 DartApiScope() { Dart_EnterScope(); } |
| 27 ~DartApiScope() { Dart_ExitScope(); } |
| 28 |
| 29 private: |
| 30 DISALLOW_COPY_AND_ASSIGN(DartApiScope); |
| 31 }; |
| 32 |
| 33 #endif // SKY_TOOLS_PACKAGER_SCOPE_H_ |
OLD | NEW |