Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
runtime
platform_isolate_manager.h
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
#ifndef FLUTTER_RUNTIME_PLATFORM_ISOLATE_MANAGER_H_
6
#define FLUTTER_RUNTIME_PLATFORM_ISOLATE_MANAGER_H_
7
8
#include <atomic>
9
#include <mutex>
10
#include <unordered_set>
11
12
#include "third_party/dart/runtime/include/dart_api.h"
13
14
namespace
flutter
{
15
16
/// Maintains a list of registered platform isolates, so that they can be
17
/// proactively shutdown as a group during shell shutdown.
18
class
PlatformIsolateManager
{
19
public
:
20
/// Returns whether the PlatformIsolateManager is shutdown. New isolates
21
/// cannot be registered after the manager is shutdown. Must be called on the
22
/// platform thread.
23
bool
HasShutdown
();
24
25
/// Returns whether the PlatformIsolateManager is shutdown. New isolates
26
/// cannot be registered after the manager is shutdown. Callable from any
27
/// thread. The result may be obsolete immediately after the call.
28
bool
HasShutdownMaybeFalseNegative
();
29
30
/// Register an isolate in the list of platform isolates. Callable from any
31
/// thread.
32
bool
RegisterPlatformIsolate
(
Dart_Isolate
isolate);
33
34
/// Remove an isolate from the list of platform isolates. Must be called from
35
/// the platform thread.
36
void
RemovePlatformIsolate
(
Dart_Isolate
isolate);
37
38
/// Shuts down all registered isolates, and the manager itself. Must be called
39
/// from the platform thread.
40
void
ShutdownPlatformIsolates
();
41
42
/// Returns whether an isolate is registered. For testing only. Callable from
43
/// any thread.
44
bool
IsRegisteredForTestingOnly
(
Dart_Isolate
isolate);
45
46
private
:
47
// This lock must be recursive because ShutdownPlatformIsolates indirectly
48
// calls RemovePlatformIsolate.
49
std::recursive_mutex lock_;
50
std::unordered_set<Dart_Isolate> platform_isolates_;
51
bool
is_shutdown_ =
false
;
52
};
53
54
}
// namespace flutter
55
56
#endif
// FLUTTER_RUNTIME_PLATFORM_ISOLATE_MANAGER_H_
flutter::PlatformIsolateManager
Definition
platform_isolate_manager.h:18
flutter::PlatformIsolateManager::ShutdownPlatformIsolates
void ShutdownPlatformIsolates()
Definition
platform_isolate_manager.cc:51
flutter::PlatformIsolateManager::RemovePlatformIsolate
void RemovePlatformIsolate(Dart_Isolate isolate)
Definition
platform_isolate_manager.cc:33
flutter::PlatformIsolateManager::HasShutdown
bool HasShutdown()
Definition
platform_isolate_manager.cc:11
flutter::PlatformIsolateManager::IsRegisteredForTestingOnly
bool IsRegisteredForTestingOnly(Dart_Isolate isolate)
Definition
platform_isolate_manager.cc:65
flutter::PlatformIsolateManager::HasShutdownMaybeFalseNegative
bool HasShutdownMaybeFalseNegative()
Definition
platform_isolate_manager.cc:17
flutter::PlatformIsolateManager::RegisterPlatformIsolate
bool RegisterPlatformIsolate(Dart_Isolate isolate)
Definition
platform_isolate_manager.cc:22
Dart_Isolate
struct _Dart_Isolate * Dart_Isolate
Definition
dart_api.h:88
flutter
Definition
asset_manager.cc:10
Generated on Fri Apr 26 2024 06:14:18 for Flutter Engine by
1.9.8