Flutter Engine
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/lib/ui/plugins/callback_cache.h"
8 
9 @implementation FlutterCallbackInformation
10 @end
11 
12 @implementation FlutterCallbackCache
13 
14 + (FlutterCallbackInformation*)lookupCallbackInformation:(int64_t)handle {
16  if (info == nullptr) {
17  return nil;
18  }
19  FlutterCallbackInformation* new_info = [[[FlutterCallbackInformation alloc] init] autorelease];
20  new_info.callbackName = [NSString stringWithUTF8String:info->name.c_str()];
21  new_info.callbackClassName = [NSString stringWithUTF8String:info->class_name.c_str()];
22  new_info.callbackLibraryPath = [NSString stringWithUTF8String:info->library_path.c_str()];
23  return new_info;
24 }
25 
26 + (void)setCachePath:(NSString*)path {
27  assert(path != nil);
29  NSString* cache_path =
30  [NSString stringWithUTF8String:flutter::DartCallbackCache::GetCachePath().c_str()];
31  // Set the "Do Not Backup" flag to ensure that the cache isn't moved off disk in
32  // low-memory situations.
33  if (![[NSFileManager defaultManager] fileExistsAtPath:cache_path]) {
34  [[NSFileManager defaultManager] createFileAtPath:cache_path contents:nil attributes:nil];
35  NSError* error = nil;
36  NSURL* URL = [NSURL fileURLWithPath:cache_path];
37  BOOL success = [URL setResourceValue:[NSNumber numberWithBool:YES]
38  forKey:NSURLIsExcludedFromBackupKey
39  error:&error];
40  if (!success) {
41  NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
42  }
43  }
44 }
45 
46 @end
const uint8_t uint32_t uint32_t GError ** error
static void SetCachePath(const std::string &path)
static std::unique_ptr< DartCallbackRepresentation > GetCallbackInformation(int64_t handle)
int BOOL
Definition: windows_types.h:37
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