Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
11
12@implementation FlutterCallbackInformation
13@end
14
15@implementation FlutterCallbackCache
16
17+ (FlutterCallbackInformation*)lookupCallbackInformation:(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}
28
29+ (void)setCachePath:(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}
48
49@end
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
static std::unique_ptr< DartCallbackRepresentation > GetCallbackInformation(int64_t handle)
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
int BOOL