Flutter Engine
dart_isolate_scope.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 
6 
7 namespace tonic {
8 
9 DartIsolateScope::DartIsolateScope(Dart_Isolate isolate) {
10  isolate_ = isolate;
11  previous_ = Dart_CurrentIsolate();
12  if (previous_ == isolate_)
13  return;
14  if (previous_)
15  Dart_ExitIsolate();
16  Dart_EnterIsolate(isolate_);
17 }
18 
20  Dart_Isolate current = Dart_CurrentIsolate();
21  TONIC_DCHECK(!current || current == isolate_);
22  if (previous_ == isolate_)
23  return;
24  if (current)
25  Dart_ExitIsolate();
26  if (previous_)
27  Dart_EnterIsolate(previous_);
28 }
29 
30 } // namespace tonic
#define TONIC_DCHECK
Definition: macros.h:32
DartIsolateScope(Dart_Isolate isolate)