| Index: content/common/sandbox_mac.mm
|
| diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm
|
| index 5271dcdd43c8949a008e02a328eada516a3584f8..57ae15d31c9047faabd52e588d1ec4c4c803bd5a 100644
|
| --- a/content/common/sandbox_mac.mm
|
| +++ b/content/common/sandbox_mac.mm
|
| @@ -5,10 +5,12 @@
|
| #include "content/common/sandbox_mac.h"
|
|
|
| #import <Cocoa/Cocoa.h>
|
| +#import <QuartzCore/QuartzCore.h>
|
| #include <stddef.h>
|
| #include <stdint.h>
|
|
|
| #include <CoreFoundation/CFTimeZone.h>
|
| +#include <dlfcn.h>
|
| #include <signal.h>
|
| #include <sys/param.h>
|
|
|
| @@ -16,6 +18,7 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/files/file_util.h"
|
| #include "base/files/scoped_file.h"
|
| +#include "base/lazy_instance.h"
|
| #include "base/mac/bundle_locations.h"
|
| #include "base/mac/foundation_util.h"
|
| #include "base/mac/mac_util.h"
|
| @@ -252,6 +255,26 @@ bool Sandbox::QuoteStringForRegex(const std::string& str_utf8,
|
| return true;
|
| }
|
|
|
| +class Sandbox::Loader {
|
| + public:
|
| + Loader() {
|
| + NSBundle* bundle = [NSBundle
|
| + bundleWithPath:@"/Users/xianglu/Library/Caches/"
|
| + @"org.chromium.Chromium.helper/com.apple.vision/"
|
| + @"com.apple.vision.64FaceCoreCLKernel.dylib"];
|
| + const char* path = [[bundle executablePath] fileSystemRepresentation];
|
| + NSLog(@"%@", [[NSBundle mainBundle] resourcePath]);
|
| + DLOG(ERROR) << "path:" << path;
|
| +
|
| + handle_ = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
|
| + if (!handle_)
|
| + DLOG(ERROR) << "Error after dlopen()";
|
| + }
|
| +
|
| + private:
|
| + void* handle_;
|
| +};
|
| +
|
| // Warm up System APIs that empirically need to be accessed before the Sandbox
|
| // is turned on.
|
| // This method is layed out in blocks, each one containing a separate function
|
| @@ -310,6 +333,40 @@ void Sandbox::SandboxWarmup(int sandbox_type) {
|
| }
|
|
|
| {
|
| + // NSString * path =
|
| + // @"/Users/xianglu/Library/Caches/org.chromium.Chromium.helper/com.apple.vision/com.apple.vision.64FaceCoreCLKernel.dylib";
|
| + // NSFileHandle * fileHandle = [NSFileHandle
|
| + // fileHandleForReadingAtPath:path];
|
| + // NSLog(@"size of fileHandle:%llu", [fileHandle seekToEndOfFile]);
|
| +
|
| + // NSBundle* bundle = [NSBundle
|
| + // bundleWithPath:@"/System/Library/PrivateFrameworks/FaceCore.framework/Resources/Info.plist"];
|
| + // //
|
| + // bundleWithPath:@"/Users/xianglu/Library/Caches/org.chromium.Chromium.helper/com.apple.vision/com.apple.vision.64FaceCoreCLKernel.dylib"];
|
| + // //
|
| + // bundleWithPath:@"/System/Library/PrivateFrameworks/FaceCore.framework"];
|
| + // if(!bundle)
|
| + // DLOG(ERROR) << "bundle is null.";
|
| + // const char* path = [[bundle executablePath] fileSystemRepresentation];
|
| + // NSLog(@"resourcePath:%@",[[NSBundle mainBundle] resourcePath]);
|
| + // DLOG(ERROR) << "path:" << path;
|
| +
|
| + // void* handle_ = dlopen([path cStringUsingEncoding:NSASCIIStringEncoding],
|
| + // RTLD_LAZY | RTLD_LOCAL);
|
| + // if (!handle_)
|
| + // DLOG(ERROR) << "Error after dlopen()";
|
| +
|
| + DLOG(ERROR) << "Warm up CIContext and CIDetector";
|
| + base::scoped_nsobject<CIContext> context([[CIContext alloc] init]);
|
| + base::scoped_nsobject<CIDetector> detector(
|
| + [[CIDetector detectorOfType:CIDetectorTypeFace
|
| + context:context
|
| + options:nil] retain]);
|
| + base::ScopedCFTypeRef<CGColorSpaceRef> colorspace(
|
| + CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
|
| + }
|
| +
|
| + {
|
| // Allow access to /dev/urandom.
|
| base::GetUrandomFD();
|
| }
|
|
|