/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ #import #import "Bridge.h" #import "Ti.h" #import "TiEvaluator.h" #import "TiProxy.h" #import "KrollContext.h" #import "KrollObject.h" #import "TiModule.h" @interface TitaniumObject : KrollObject { @private NSMutableDictionary *modules; TiHost *host; id pageContext; NSMutableDictionary *dynprops; } -(id)initWithContext:(KrollContext*)context_ host:(TiHost*)host_ context:(id)context baseURL:(NSURL*)baseURL_; -(KrollObject*)addModule:(NSString*)name module:(TiModule*)module; -(TiModule*)moduleNamed:(NSString*)name context:(id)context; @end @interface KrollBridge : Bridge { @private NSURL * currentURL; KrollContext *context; NSDictionary *preload; NSMutableDictionary *modules; TitaniumObject *titanium; BOOL shutdown; BOOL evaluationError; NSMutableArray *proxies; //NOTE: Do NOT treat registeredProxies like a mutableDictionary; mutable dictionaries copy keys, //CFMutableDictionaryRefs only retain keys, which lets them work with proxies properly. CFMutableDictionaryRef registeredProxies; NSCondition *shutdownCondition; NSRecursiveLock *proxyLock; } - (void)boot:(id)callback url:(NSURL*)url_ preload:(NSDictionary*)preload_; - (void)evalJSWithoutResult:(NSString*)code; - (id)evalJSAndWait:(NSString*)code; - (BOOL)evaluationError; - (void)fireEvent:(id)listener withObject:(id)obj remove:(BOOL)yn thisObject:(TiProxy*)thisObject; - (id)preloadForKey:(id)key name:(id)name; - (KrollContext*)krollContext; + (NSArray *)krollBridgesUsingProxy:(id)proxy; + (int)countOfKrollBridgesUsingProxy:(id)proxy; + (BOOL)krollBridgeExists:(KrollBridge *)bridge; + (KrollBridge *)krollBridgeForThreadName:(NSString *)threadName; -(void)enqueueEvent:(NSString*)type forProxy:(TiProxy *)proxy withObject:(id)obj withSource:(id)source; -(void)registerProxy:(id)proxy krollObject:(KrollObject *)ourKrollObject; -(int)forceGarbageCollectNow; @end