Flutter Engine
The Flutter Engine
Class Methods | List of all members
FlutterCallbackCache Class Reference

#import <FlutterCallbackCache.h>

Inheritance diagram for FlutterCallbackCache:

Class Methods

(FlutterCallbackInformation *) + lookupCallbackInformation:
 
(void) + setCachePath: [implementation]
 

Detailed Description

The cache containing callback information for spawning a FlutterHeadlessDartRunner.

Definition at line 37 of file FlutterCallbackCache.h.

Method Documentation

◆ lookupCallbackInformation:

+ (FlutterCallbackInformation *) lookupCallbackInformation: (int64_t)  handle

Returns the callback information for the given callback handle. This callback information can be used when spawning a FlutterHeadlessDartRunner.

Parameters
handleThe handle for a callback, provided by the Dart method PluginUtilities.getCallbackHandle.
Returns
A FlutterCallbackInformation object which contains the name of the callback, the name of the class in which the callback is defined, and the path of the library which contains the callback. If the provided handle is invalid, nil is returned.

Definition at line 10 of file FlutterCallbackCache.mm.

17 :(int64_t)handle {
19 if (info == nullptr) {
20 return nil;
21 }
23 new_info.callbackName = [NSString stringWithUTF8String:info->name.c_str()];
24 new_info.callbackClassName = [NSString stringWithUTF8String:info->class_name.c_str()];
25 new_info.callbackLibraryPath = [NSString stringWithUTF8String:info->library_path.c_str()];
26 return new_info;
27}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static std::unique_ptr< DartCallbackRepresentation > GetCallbackInformation(int64_t handle)

◆ setCachePath:

+ (void) setCachePath: (NSString*)  path
implementation

Definition at line 10 of file FlutterCallbackCache.mm.

29 :(NSString*)path {
30 FML_DCHECK(path != nil);
32 NSString* cache_path =
33 [NSString stringWithUTF8String:flutter::DartCallbackCache::GetCachePath().c_str()];
34 // Set the "Do Not Backup" flag to ensure that the cache isn't moved off disk in
35 // low-memory situations.
36 if (![[NSFileManager defaultManager] fileExistsAtPath:cache_path]) {
37 [[NSFileManager defaultManager] createFileAtPath:cache_path contents:nil attributes:nil];
38 NSError* error = nil;
39 NSURL* URL = [NSURL fileURLWithPath:cache_path];
40 BOOL success = [URL setResourceValue:[NSNumber numberWithBool:YES]
41 forKey:NSURLIsExcludedFromBackupKey
42 error:&error];
43 if (!success) {
44 NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
45 }
46 }
47}
static void SetCachePath(const std::string &path)
const uint8_t uint32_t uint32_t GError ** error
#define FML_DCHECK(condition)
Definition: logging.h:103
Definition: dart.idl:68
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
int BOOL
Definition: windows_types.h:37

The documentation for this class was generated from the following files: