Skip to content

Commit

Permalink
Merge pull request #6345 from vishalduggal/timob-17926
Browse files Browse the repository at this point in the history
[TIMOB-11903][TIMOB-17926] Upgrade to new TiCore/TiVerify libraries
  • Loading branch information
jonalter committed Nov 13, 2014
2 parents d779159 + a7895b9 commit 4566d91
Show file tree
Hide file tree
Showing 29 changed files with 1,630 additions and 416 deletions.
12 changes: 9 additions & 3 deletions iphone/Classes/APIModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#import "TiUtils.h"
#import "TiBase.h"
#import "TiApp.h"
#import "TiDebugger.h"
#import "TiExceptionHandler.h"

#ifdef TI_DEBUGGER_PROFILER
#import "TiDebugger.h"
#endif
extern NSString * const TI_APPLICATION_DEPLOYTYPE;

@implementation APIModule
Expand All @@ -25,6 +26,7 @@ -(void)logMessage:(NSArray*)args severity:(NSString*)severity
NSMutableString* message = [NSMutableString string];

NSString* lcSeverity = [severity lowercaseString];
#ifdef TI_DEBUGGER_PROFILER
DebuggerLogLevel level = OUT;
if ([lcSeverity isEqualToString:@"warn"]) {
level = WARN;
Expand All @@ -50,12 +52,16 @@ -(void)logMessage:(NSArray*)args severity:(NSString*)severity

TiDebuggerLogMessage(level, [messages componentsJoinedByString:@" "]);
}
else {
else
#endif
{
#ifdef TI_DEBUGGER_PROFILER
if ([TI_APPLICATION_DEPLOYTYPE isEqualToString:@"production"]) {
if (level != ERR) {
return;
}
}
#endif
NSLog(@"[%@] %@", [severity uppercaseString], [args componentsJoinedByString:@" "]);
fflush(stderr);
}
Expand Down
20 changes: 12 additions & 8 deletions iphone/Classes/KrollBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
#import "ApplicationMods.h"
#import <libkern/OSAtomic.h>
#import "KrollContext.h"
#import "TiDebugger.h"
#import "TiConsole.h"
#import "TiExceptionHandler.h"
#import "APSAnalytics.h"

#ifdef KROLL_COVERAGE
# include "KrollCoverage.h"
#endif

#ifdef TI_DEBUGGER_PROFILER
#import "TiDebugger.h"
#endif
extern BOOL const TI_APPLICATION_ANALYTICS;
extern NSString * const TI_APPLICATION_DEPLOYTYPE;
extern NSString * const TI_APPLICATION_GUID;
Expand Down Expand Up @@ -449,16 +450,18 @@ - (void)evalFileOnThread:(NSString*)path context:(KrollContext*)context_

// only continue if we don't have any exceptions from above
if (exception == NULL) {
#ifdef TI_DEBUGGER_PROFILER
if ([[self host] debugMode]) {
TiDebuggerBeginScript(context_,urlCString);
}
#endif
TiEvalScript(jsContext, jsCode, NULL, jsURL, 1, &exception);
#ifdef TI_DEBUGGER_PROFILER
if ([[self host] debugMode]) {
TiDebuggerEndScript(context_);
}
if (exception == NULL) {
#endif
if (exception == NULL) {
evaluationError = NO;
}
}
Expand Down Expand Up @@ -911,19 +914,20 @@ -(id)require:(KrollContext*)kroll path:(NSString*)path
NSURL *url_ = [TiHost resourceBasedURL:urlPath baseURL:NULL];
const char *urlCString = [[url_ absoluteString] UTF8String];
KrollWrapper* wrapper = nil;
#ifdef TI_DEBUGGER_PROFILER
if ([[self host] debugMode] && ![module isJSModule]) {
TiDebuggerBeginScript([self krollContext],urlCString);
}
#endif
NSString * dataContents = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
wrapper = [self loadCommonJSModule:dataContents withSourceURL:url_];
[dataContents release];

#ifdef TI_DEBUGGER_PROFILER
if ([[self host] debugMode] && ![module isJSModule]) {
TiDebuggerEndScript([self krollContext]);
}
#endif
if (![wrapper respondsToSelector:@selector(replaceValue:forKey:notification:)]) {
[self setCurrentURL:oldURL];
@throw [NSException exceptionWithName:@"org.appcelerator.kroll"
Expand Down
1 change: 0 additions & 1 deletion iphone/Classes/KrollContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#import <Foundation/Foundation.h>
#import "TiCore.h"
#import "TiBase.h"
#import "TiContextRefPrivate.h"

@class KrollContext;
@class KrollCallback;
Expand Down
11 changes: 8 additions & 3 deletions iphone/Classes/KrollContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
#import "TiLocale.h"

#include <pthread.h>
#ifdef TI_DEBUGGER_PROFILER
#import "TiDebugger.h"
#import "TiExceptionHandler.h"
#import "TiProfiler.h"
#endif
#import "TiExceptionHandler.h"

#import "TiUIAlertDialogProxy.h"

Expand Down Expand Up @@ -888,8 +890,10 @@ -(void)stop
if (debugger!=NULL)
{
TiObjectRef globalRef = TiContextGetGlobalObject(context);
#ifdef TI_DEBUGGER_PROFILER
TiDebuggerDestroy(self,globalRef,debugger);
debugger = NULL;
#endif
debugger = NULL;
}
[condition signal];
[condition unlock];
Expand Down Expand Up @@ -1107,12 +1111,13 @@ -(void)main

// TODO: We might want to be smarter than this, and do some KVO on the delegate's
// 'debugMode' property or something... and start/stop the debugger as necessary.
#ifdef TI_DEBUGGER_PROFILER
if ([[self delegate] shouldDebugContext]) {
debugger = TiDebuggerCreate(self,globalRef);
} else if ([[self delegate] shouldProfileContext]) {
TiProfilerEnable(globalRef);
}
#endif
// we register an empty kroll string that allows us to pluck out this instance
KrollObject *kroll = [[KrollObject alloc] initWithTarget:nil context:self];
TiValueRef krollRef = [KrollObject toValue:self value:kroll];
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#import "XHRBridge.h"
#endif
#import "TiRootViewController.h"
#import <TiCore/TiContextRef.h>
#import <JavaScriptCore/TiContextRef.h>

extern BOOL applicationInMemoryPanic;

Expand Down
12 changes: 8 additions & 4 deletions iphone/Classes/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#import "TiErrorController.h"
#import "NSData+Additions.h"
#import "ImageLoader.h"
#ifdef TI_DEBUGGER_PROFILER
#import "TiDebugger.h"
#import "TiProfiler.h"
#endif
#import <QuartzCore/QuartzCore.h>
#import <AVFoundation/AVFoundation.h>
#import "ApplicationDefaults.h"
Expand Down Expand Up @@ -180,7 +182,7 @@ - (void)boot

sessionId = [[TiUtils createUUID] retain];
TITANIUM_VERSION = [[NSString stringWithCString:TI_VERSION_STR encoding:NSUTF8StringEncoding] retain];

#ifdef TI_DEBUGGER_PROFILER
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"debugger" ofType:@"plist"];
if (filePath != nil) {
NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
Expand Down Expand Up @@ -245,7 +247,8 @@ - (void)boot
[params release];
#endif
}
[self appBoot];
#endif
[self appBoot];
}

- (void)appBoot
Expand All @@ -260,7 +263,6 @@ - (void)validator
{
[[[NSClassFromString(TIV) alloc] init] autorelease];
}

- (void)booted:(id)bridge
{
if ([bridge isKindOfClass:[KrollBridge class]])
Expand All @@ -271,7 +273,7 @@ - (void)booted:(id)bridge
if (localNotification != nil) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTiLocalNotification object:localNotification userInfo:nil];
}
TiThreadPerformOnMainThread(^{[self validator];}, YES);
TiThreadPerformOnMainThread(^{[self validator];}, YES);
}
}

Expand Down Expand Up @@ -940,7 +942,9 @@ - (void)dealloc
RELEASE_TO_NIL(remoteNotification);
RELEASE_TO_NIL(splashScreenImage);
if ([self debugMode]) {
#ifdef TI_DEBUGGER_PROFILER
TiDebuggerStop();
#endif
}
RELEASE_TO_NIL(backgroundServices);
RELEASE_TO_NIL(localNotification);
Expand Down
5 changes: 4 additions & 1 deletion iphone/Classes/TiBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*/
#import "TiBase.h"
#import "TiApp.h"
#ifdef TI_DEBUGGER_PROFILER
#import "TiDebugger.h"

#endif
#include <stdarg.h>
#include <pthread.h>
#include <sys/time.h>
Expand Down Expand Up @@ -91,7 +92,9 @@ void TiLogMessage(NSString* str, ...) {

NSString* message = [[NSString alloc] initWithFormat:str arguments:args];
if ([[TiApp app] debugMode]) {
#ifdef TI_DEBUGGER_PROFILER
TiDebuggerLogMessage(OUT, message);
#endif
}
else {

Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiBindingTiValue.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
if(objRef == NULL){
return nil;
}
TiType tt = TiValueGetType(jsContext, objRef);
JSType tt = TiValueGetType(jsContext, objRef);
switch (tt) {
case kTITypeUndefined:{
return nil;
Expand Down
31 changes: 0 additions & 31 deletions iphone/Classes/TiDebugger.h

This file was deleted.

21 changes: 0 additions & 21 deletions iphone/Classes/TiProfiler.h

This file was deleted.

2 changes: 1 addition & 1 deletion iphone/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os,platform,sys,urllib,gzip,glob
from progressbar import ProgressBar

ticore_version = '19'
ticore_version = '20'

# NOTE: this is simply a pre-built version of the source at http://github.com/appcelerator/tijscore
# since this is so freaking complicated to setup and build in an stable environment, and since
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Appcelerator Titanium License
* This source code and all modifications done by Appcelerator
* are licensed under the Apache Public License (version 2) and
* are Copyright (c) 2009-2012 by Appcelerator, Inc.
* are Copyright (c) 2009-2014 by Appcelerator, Inc.
*/

/*
Expand Down Expand Up @@ -34,10 +34,10 @@
#ifndef Ti_h
#define Ti_h

#include <TiCore/TiBase.h>
#include <TiCore/TiContextRef.h>
#include <TiCore/TiStringRef.h>
#include <TiCore/TiObjectRef.h>
#include <TiCore/TiValueRef.h>
#include <JavaScriptCore/TiBase.h>
#include <JavaScriptCore/TiContextRef.h>
#include <JavaScriptCore/TiStringRef.h>
#include <JavaScriptCore/TiObjectRef.h>
#include <JavaScriptCore/TiValueRef.h>

#endif /* Ti_h */

0 comments on commit 4566d91

Please sign in to comment.