Files
Chinmay Garde eec74e5c92 Rename the blink namespace to flutter. (#8517)
Some components in the Flutter engine were derived from the forked blink codebase. While the forked components have either been removed or rewritten, the use of the blink namespace has mostly (and inconsistently) remained. This renames the blink namesapce to flutter for consistency. There are no functional changes in this patch.
2019-04-09 12:44:42 -07:00

47 lines
1.8 KiB
Plaintext

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h"
#include "flutter/lib/ui/plugins/callback_cache.h"
@implementation FlutterCallbackInformation
@end
@implementation FlutterCallbackCache
+ (FlutterCallbackInformation*)lookupCallbackInformation:(int64_t)handle {
auto info = flutter::DartCallbackCache::GetCallbackInformation(handle);
if (info == nullptr) {
return nil;
}
FlutterCallbackInformation* new_info = [[FlutterCallbackInformation alloc] init];
new_info.callbackName = [NSString stringWithUTF8String:info->name.c_str()];
new_info.callbackClassName = [NSString stringWithUTF8String:info->class_name.c_str()];
new_info.callbackLibraryPath = [NSString stringWithUTF8String:info->library_path.c_str()];
return new_info;
}
+ (void)setCachePath:(NSString*)path {
assert(path != nil);
flutter::DartCallbackCache::SetCachePath([path UTF8String]);
NSString* cache_path =
[NSString stringWithUTF8String:flutter::DartCallbackCache::GetCachePath().c_str()];
// Set the "Do Not Backup" flag to ensure that the cache isn't moved off disk in
// low-memory situations.
if (![[NSFileManager defaultManager] fileExistsAtPath:cache_path]) {
[[NSFileManager defaultManager] createFileAtPath:cache_path contents:nil attributes:nil];
NSError* error = nil;
NSURL* URL = [NSURL fileURLWithPath:cache_path];
BOOL success = [URL setResourceValue:[NSNumber numberWithBool:YES]
forKey:NSURLIsExcludedFromBackupKey
error:&error];
if (!success) {
NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
}
}
}
@end