Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plamen5kov/refactored 5.2.361 #536

Merged
merged 36 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ee3109d
added built binaries and includes
Plamen5kov Aug 8, 2016
756cbf0
updated configuration to use c++ stl instead of stlport library
Plamen5kov Aug 12, 2016
7448d8d
refactored v8 api usage
Plamen5kov Aug 12, 2016
139553f
object manager now has it's own instance isolate
Plamen5kov Aug 12, 2016
ac0a9b4
broke Wrap function
Plamen5kov Aug 12, 2016
868918e
changed weakcallbacktype options on setWeak
Plamen5kov Aug 14, 2016
9c4198d
forgot to use new v8 api for setWeak fix
Plamen5kov Aug 14, 2016
e2a0fb5
updated armeabi-v7a binaries
Plamen5kov Aug 15, 2016
4ee52c7
updated binaries built with ndk r12b
Plamen5kov Aug 17, 2016
f72089b
return the wrapped function when property func name is get accessed
blagoev Aug 17, 2016
1ed913c
optimize the default path (no profiler enabled)
blagoev Aug 17, 2016
484da47
fix compile error
Plamen5kov Aug 23, 2016
fb35bc7
fix rebase errors
petekanev Aug 23, 2016
0204799
fix function wrappers for when v8 profiler is enabled
blagoev Aug 23, 2016
d299a7d
fix build after merge
blagoev Aug 23, 2016
c27dc2a
fix profiler with newer version of v8
blagoev Aug 24, 2016
1d7cf86
revert gradle to 2.10
blagoev Aug 24, 2016
612d3bb
(possible fix ) limit memory usage for travis
blagoev Aug 24, 2016
9ad4c16
show more output from gradle
blagoev Aug 24, 2016
1efb57b
bump the gradle
blagoev Aug 24, 2016
4c1c872
bump gradle experimental version
blagoev Aug 25, 2016
3381f95
fixed unused warnings failing build
blagoev Aug 25, 2016
e2651f2
fix use after free bug
blagoev Aug 25, 2016
330dc1b
enabled debug gradle build to help fix travis build
blagoev Aug 25, 2016
1babdb5
remove debug log
blagoev Aug 25, 2016
0a982dd
enable sudo build
blagoev Aug 25, 2016
9ac1fa7
remove arena flag
blagoev Aug 25, 2016
23fd433
fix travis build of runtime test app
blagoev Aug 25, 2016
a37b604
fix travis build again
blagoev Aug 25, 2016
40e9232
output emulator logcat
blagoev Aug 25, 2016
3e77c36
yet another try to fix travis build
blagoev Aug 25, 2016
6f24a1e
remove logcat dump
blagoev Aug 25, 2016
88a1814
adb logcat print and exit
blagoev Aug 25, 2016
63629aa
added readwritelock implementation
Plamen5kov Sep 10, 2016
4f54cde
fix rebase
petekanev Sep 19, 2016
f7a4144
fix failing tests after recent changes, introduce private API so that…
petekanev Sep 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
env:
global:
- NDK_VERSION=r11c
- NDK_VERSION=r12b
- DATE=$(date +%Y-%m-%d)
- PACKAGE_VERSION=next-$DATE-$TRAVIS_BUILD_NUMBER
- PACKAGE_NAME=tns-android
sudo: false
sudo: true
language: android
jdk:
- oraclejdk8
Expand Down Expand Up @@ -39,7 +39,8 @@ script:
- echo no | android create avd --force -n Arm21 -t android-21 -b armeabi-v7a -c 12M
- emulator -avd Arm21 -no-skin -no-audio -no-window &
- android-wait-for-emulator
- "cd test-app && ./gradlew runtest -PembedBindingGenerator=true --stacktrace"
- "cd test-app && ./gradlew assembleDebug runtests -PembedBindingGenerator=true --stacktrace"
- adb -e logcat -d 300
- cd ..
before_deploy:
- FULL_PACKAGE_VERSION=`sed -n 's/\s*"version":\s*"\([a-zA-Z0-9\.]*\)"\s*,*/\1/p' dist/package.json`
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
13 changes: 10 additions & 3 deletions runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.7.0-beta3'
classpath 'com.android.tools.build:gradle-experimental:0.8.0-beta2'
}
}

Expand Down Expand Up @@ -59,9 +59,16 @@ model {

ldLibs.addAll(["android", "dl", "log", "atomic", "z"])

stl = "stlport_static"
stl = "c++_static"

abiFilters.addAll(["armeabi-v7a", "x86", "arm64-v8a"])
if (ndkDebuggable)
{
abiFilters.addAll(["armeabi-v7a"])
}
else
{
abiFilters.addAll(["armeabi-v7a", "x86", "arm64-v8a"])
}
}

android.sources {
Expand Down
2 changes: 1 addition & 1 deletion runtime/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 changes: 5 additions & 2 deletions runtime/src/main/java/com/tns/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public class Runtime

private native void passUncaughtExceptionToJsNative(int runtimeId, Throwable ex, String stackTrace);

private native void ClearStartupData(int runtimeId);
private native void clearStartupData(int runtimeId);

// Used to determine the bitness of the current process (32 vs 64)
public static native int getPointerSize();

void passUncaughtExceptionToJs(Throwable ex, String stackTrace)
{
Expand Down Expand Up @@ -231,7 +234,7 @@ private void init(Logger logger, Debugger debugger, String appName, File runtime
jsDebugger.start();
}

ClearStartupData(getRuntimeId()); // It's safe to delete the data after the V8 debugger is initialized
clearStartupData(getRuntimeId()); // It's safe to delete the data after the V8 debugger is initialized

if (logger.isEnabled())
{
Expand Down
8 changes: 4 additions & 4 deletions runtime/src/main/jni/ArgConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "NativeScriptException.h"
#include "NumericCasts.h"
#include "Runtime.h"
#include "V8GlobalHelpers.h"
#include <sstream>

using namespace v8;
Expand Down Expand Up @@ -78,8 +79,8 @@ void ArgConverter::NativeScriptLongFunctionCallback(const v8::FunctionCallbackIn
auto isolate = args.GetIsolate();
auto thiz = args.This();
auto cache = GetTypeLongCache(isolate);
thiz->SetHiddenValue(V8StringConstants::GetJavaLong(isolate), Boolean::New(isolate, true));
NumericCasts::MarkAsLong(thiz, args[0]);
V8SetPrivateValue(isolate, thiz, V8StringConstants::GetJavaLong(isolate), Boolean::New(isolate, true));
NumericCasts::MarkAsLong(isolate, thiz, args[0]);
thiz->SetPrototype(Local<NumberObject>::New(isolate, *cache->NanNumberObject));
}
catch (NativeScriptException& e)
Expand Down Expand Up @@ -329,8 +330,7 @@ Local<String> ArgConverter::ConvertToV8String(Isolate *isolate, const jchar* dat

Local<String> ArgConverter::ConvertToV8String(Isolate *isolate, const string& s)
{
Local<String> str;
String::NewFromUtf8(isolate, s.c_str(), NewStringType::kNormal, s.length()).ToLocal(&str);
Local<String> str = String::NewFromUtf8(isolate, s.c_str(), NewStringType::kNormal, s.length()).ToLocalChecked();
return str;
}

Expand Down
11 changes: 8 additions & 3 deletions runtime/src/main/jni/CallbackHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,11 +814,13 @@ Local<Value> CallbackHandlers::CallJSMethod(Isolate *isolate, JNIEnv *_env,
auto jsArgs = ArgConverter::ConvertJavaArgsToJsArgs(isolate, args);
int argc = jsArgs->Length();

Local<Value> arguments[argc];
for (int i = 0; i < argc; i++) {
Local<Value>* arguments = new Local<Value>[argc];
for (int i = 0; i < argc; i++)
{
arguments[i] = jsArgs->Get(i);
}


DEBUG_WRITE("implementationObject->GetIdentityHash()=%d", jsObject->GetIdentityHash());

TryCatch tc;
Expand All @@ -828,9 +830,12 @@ Local<Value> CallbackHandlers::CallJSMethod(Isolate *isolate, JNIEnv *_env,
jsResult = jsMethod->Call(jsObject, argc, argc == 0 ? nullptr : arguments);
}

delete [] arguments;

//TODO: if javaResult is a pure js object create a java object that represents this object in java land

if (tc.HasCaught()) {
if (tc.HasCaught())
{
stringstream ss;
ss << "Calling js method " << methodName << " failed";
string exceptionMessage = ss.str();
Expand Down
7 changes: 5 additions & 2 deletions runtime/src/main/jni/JsArgConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "NumericCasts.h"
#include "NativeScriptException.h"
#include "Runtime.h"
#include "V8GlobalHelpers.h"
#include <cstdlib>

using namespace v8;
using namespace std;
Expand Down Expand Up @@ -126,7 +128,7 @@ bool JsArgConverter::ConvertArg(const Local<Value>& arg, int index)
{
auto jsObject = arg->ToObject();

auto castType = NumericCasts::GetCastType(jsObject);
auto castType = NumericCasts::GetCastType(m_isolate, jsObject);

Local<Value> castValue;
JniLocalRef obj;
Expand Down Expand Up @@ -218,7 +220,8 @@ bool JsArgConverter::ConvertArg(const Local<Value>& arg, int index)
case CastType::None:
obj = objectManager->GetJavaObjectByJsObject(jsObject);

castValue = jsObject->GetHiddenValue(ArgConverter::ConvertToV8String(m_isolate, V8StringConstants::NULL_NODE_NAME));
V8GetPrivateValue(m_isolate, jsObject, ArgConverter::ConvertToV8String(m_isolate, V8StringConstants::NULL_NODE_NAME), castValue);

if(!castValue.IsEmpty()) {
SetConvertedObject(index, nullptr);
success = true;
Expand Down
6 changes: 4 additions & 2 deletions runtime/src/main/jni/JsArgToArrayConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "NativeScriptException.h"
#include "Runtime.h"
#include "MetadataNode.h"
#include "V8GlobalHelpers.h"

using namespace v8;
using namespace std;
Expand Down Expand Up @@ -155,7 +156,8 @@ bool JsArgToArrayConverter::ConvertArg(const Local<Value>& arg, int index)
{
auto jsObj = arg->ToObject();

auto castType = NumericCasts::GetCastType(jsObj);
auto castType = NumericCasts::GetCastType(m_isolate, jsObj);

Local<Value> castValue;
jchar charValue;
jbyte byteValue;
Expand Down Expand Up @@ -268,7 +270,7 @@ bool JsArgToArrayConverter::ConvertArg(const Local<Value>& arg, int index)
case CastType::None:
obj = objectManager->GetJavaObjectByJsObject(jsObj);

castValue = jsObj->GetHiddenValue(V8StringConstants::GetNullNodeName(m_isolate));
V8GetPrivateValue(m_isolate, jsObj, V8StringConstants::GetNullNodeName(m_isolate), castValue);

if(!castValue.IsEmpty()) {
auto node = reinterpret_cast<MetadataNode*>(castValue.As<External>()->Value());
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/main/jni/LRUCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace tns
typedef std::list<key_type> key_tracker_type;

// Key to value and key history iterator
typedef std::tr1::unordered_map< key_type, std::pair<value_type, typename key_tracker_type::iterator> > key_to_value_type;
typedef std::unordered_map< key_type, std::pair<value_type, typename key_tracker_type::iterator> > key_to_value_type;

// Constuctor specifies the cached function and
// the maximum number of records to be stored
Expand Down
Loading