static CGFloat ScreenScale_;
static NSString *Idiom_;
+static NSObject *HostConfig_;
static NSMutableSet *BridgedHosts_;
static NSMutableSet *PipelinedHosts_;
}
- (void) addBridgedHost:(NSString *)host {
- [BridgedHosts_ performSelectorOnMainThread:@selector(addObject:) withObject:host waitUntilDone:NO];
-}
+@synchronized (HostConfig_) {
+ [BridgedHosts_ addObject:host];
+} }
- (void) addPipelinedHost:(NSString *)host scheme:(NSString *)scheme {
+@synchronized (HostConfig_) {
if (scheme != (id) [WebUndefined undefined])
host = [NSString stringWithFormat:@"%@:%@", [scheme lowercaseString], host];
- [PipelinedHosts_ performSelectorOnMainThread:@selector(addObject:) withObject:host waitUntilDone:NO];
-}
+ [PipelinedHosts_ addObject:host];
+} }
- (void) popViewController:(NSNumber *)value {
if (value == (id) [WebUndefined undefined])
NSURLResponse *response([source response]);
NSURL *url([response URL]);
- if ([[[url scheme] lowercaseString] isEqualToString:@"https"])
- if ([BridgedHosts_ containsObject:[url host]])
- [window setValue:cydia_ forKey:@"cydia"];
+ @synchronized (HostConfig_) {
+ if ([[[url scheme] lowercaseString] isEqualToString:@"https"])
+ if ([BridgedHosts_ containsObject:[url host]])
+ [window setValue:cydia_ forKey:@"cydia"];
+ }
}
- (NSURLRequest *) webView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
[self setApplicationSupportsShakeToEdit:NO];
- [BridgedHosts_ addObject:[[NSURL URLWithString:CydiaURL(@"")] host]];
+ @synchronized (HostConfig_) {
+ [BridgedHosts_ addObject:[[NSURL URLWithString:CydiaURL(@"")] host]];
+ }
[NSURLCache setSharedURLCache:[[[SDURLCache alloc]
initWithMemoryCapacity:524288
NSString *compound([NSString stringWithFormat:@"%@:%@", scheme, host]);
- if ([copy respondsToSelector:@selector(setHTTPShouldUsePipelining:)])
- if ([PipelinedHosts_ containsObject:host] || [PipelinedHosts_ containsObject:compound])
- [copy setHTTPShouldUsePipelining:YES];
+ @synchronized (HostConfig_) {
+ if ([copy respondsToSelector:@selector(setHTTPShouldUsePipelining:)])
+ if ([PipelinedHosts_ containsObject:host] || [PipelinedHosts_ containsObject:compound])
+ [copy setHTTPShouldUsePipelining:YES];
+ }
if ((self = _NSURLConnection$init$(self, _cmd, copy, delegate, usesCache, maxContentLength, startImmediately, connectionProperties)) != nil) {
} return self;
NSLog(@"unknown UIUserInterfaceIdiom!");
}
- BridgedHosts_ = [NSMutableSet setWithCapacity:2];
- PipelinedHosts_ = [NSMutableSet setWithCapacity:2];
+ HostConfig_ = [[NSObject alloc] init];
+ @synchronized (HostConfig_) {
+ BridgedHosts_ = [NSMutableSet setWithCapacity:4];
+ PipelinedHosts_ = [NSMutableSet setWithCapacity:4];
+ }
UI_ = CydiaURL([NSString stringWithFormat:@"ui/ios~%@", Idiom_]);