| Flutter Windows Embedder |

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
5 #include "flutter/shell/platform/common/isolate_scope.h"
6
7 namespace flutter {
8
9 Isolate Isolate::Current() {
10 Dart_Isolate isolate = Dart_CurrentIsolate();
11 return Isolate(isolate);
12 }
13
14 IsolateScope::IsolateScope(const Isolate& isolate) {
15 isolate_ = isolate.isolate_;
16 previous_ = Dart_CurrentIsolate();
17 if (previous_ == isolate_) {
18 return;
19 }
20 if (previous_) {
21 Dart_ExitIsolate();
22 }
23 Dart_EnterIsolate(isolate_);
24 };
25
26 IsolateScope::~IsolateScope() {
27 Dart_Isolate current = Dart_CurrentIsolate();
28 FML_DCHECK(!current || current == isolate_);
29 if (previous_ == isolate_) {
30 return;
31 }
32 if (current) {
33 Dart_ExitIsolate();
34 }
35 if (previous_) {
36 Dart_EnterIsolate(previous_);
37 }
38 }
39
40 } // namespace flutter
flutter::Isolate
Definition: isolate_scope.h:15
flutter::Isolate::Current
static Isolate Current()
Definition: isolate_scope.cc:9
flutter::IsolateScope::~IsolateScope
~IsolateScope()
Definition: isolate_scope.cc:26
flutter::IsolateScope::IsolateScope
IsolateScope(const Isolate &isolate)
Definition: isolate_scope.cc:14
isolate_scope.h
flutter
Definition: accessibility_bridge_windows.cc:11