Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
shell
platform
darwin
ios
framework
Source
FlutterCallbackCache.mm
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
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h"
6
7
#include "flutter/fml/logging.h"
8
#include "flutter/lib/ui/plugins/callback_cache.h"
9
10
FLUTTER_ASSERT_ARC
11
12
@implementation
FlutterCallbackInformation
13
@end
14
15
@implementation
FlutterCallbackCache
16
17
+ (
FlutterCallbackInformation
*)lookupCallbackInformation:(int64_t)handle {
18
auto
info
=
flutter::DartCallbackCache::GetCallbackInformation
(handle);
19
if
(
info
==
nullptr
) {
20
return
nil;
21
}
22
FlutterCallbackInformation
* new_info = [[
FlutterCallbackInformation
alloc] init];
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
}
28
29
+ (void)setCachePath:(NSString*)path {
30
FML_DCHECK
(path != nil);
31
flutter::DartCallbackCache::SetCachePath
([path UTF8String]);
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
}
48
49
@end
info
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition
DM.cpp:213
flutter::DartCallbackCache::GetCallbackInformation
static std::unique_ptr< DartCallbackRepresentation > GetCallbackInformation(int64_t handle)
Definition
callback_cache.cc:66
flutter::DartCallbackCache::SetCachePath
static void SetCachePath(const std::string &path)
Definition
callback_cache.cc:35
error
const uint8_t uint32_t uint32_t GError ** error
Definition
fl_pixel_buffer_texture_test.cc:40
FML_DCHECK
#define FML_DCHECK(condition)
Definition
logging.h:103
FlutterCallbackCache
Definition
FlutterCallbackCache.h:38
FlutterCallbackInformation
Definition
FlutterCallbackCache.h:18
FlutterCallbackInformation::callbackLibraryPath
NSString * callbackLibraryPath
Definition
FlutterCallbackCache.h:29
FlutterCallbackInformation::callbackClassName
NSString * callbackClassName
Definition
FlutterCallbackCache.h:25
FlutterCallbackInformation::callbackName
NSString * callbackName
Definition
FlutterCallbackCache.h:21
URL
Definition
dart.idl:68
FLUTTER_ASSERT_ARC
Definition
FlutterChannelKeyResponder.mm:13
BOOL
int BOOL
Definition
windows_types.h:37
Generated on Fri Apr 26 2024 06:14:24 for Flutter Engine by
1.9.8