Merge branch 'master' into yoga_thread_safety_master

This commit is contained in:
Trung Bùi
2018-07-06 09:16:56 +07:00
committed by GitHub
8 changed files with 1443 additions and 13601 deletions

View File

@@ -175,6 +175,8 @@ public class YogaNode implements Cloneable {
jni_YGNodeInsertSharedChild(mNativePointer, child.mNativePointer, i);
}
private native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer);
private native long jni_YGNodeClone(long nativePointer, Object newNode);
@Override
@@ -182,6 +184,14 @@ public class YogaNode implements Cloneable {
try {
YogaNode clonedYogaNode = (YogaNode) super.clone();
long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode);
if (mChildren != null) {
for (YogaNode child : mChildren) {
child.jni_YGNodeSetOwner(child.mNativePointer, 0);
child.mOwner = null;
}
}
clonedYogaNode.mNativePointer = clonedNativePointer;
clonedYogaNode.mOwner = null;
clonedYogaNode.mChildren =

View File

@@ -1,10 +1,10 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
/*
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <fb/fbjni.h>
#include <yoga/YGNode.h>
#include <yoga/Yoga.h>
@@ -268,6 +268,16 @@ jlong jni_YGNodeNewWithConfig(alias_ref<jobject> thiz, jlong configPointer) {
return reinterpret_cast<jlong>(node);
}
void jni_YGNodeSetOwner(
alias_ref<jobject> thiz,
jlong nativePointer,
jlong newOwnerNativePointer) {
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
const YGNodeRef newOwnerNode = _jlong2YGNodeRef(newOwnerNativePointer);
node->setOwner(newOwnerNode);
}
jlong jni_YGNodeClone(
alias_ref<jobject> thiz,
jlong nativePointer,
@@ -667,6 +677,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
YGMakeNativeMethod(jni_YGNodePrint),
YGMakeNativeMethod(jni_YGNodeClone),
YGMakeNativeMethod(jni_YGNodeSetOwner),
});
registerNatives(
"com/facebook/yoga/YogaConfig",

12381
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,21 +4,22 @@
"version": "1.0.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"antd": "^3.2.0",
"atob": "^2.0.3",
"gatsby": "^1.9.158",
"gatsby-link": "^1.6.34",
"gatsby-plugin-antd": "^1.0.10",
"gatsby-plugin-google-analytics": "^1.0.19",
"gatsby-plugin-less": "^1.1.4",
"gatsby-plugin-react-helmet": "^2.0.3",
"gatsby-plugin-react-next": "^1.0.8",
"gatsby-remark-prismjs": "^1.2.14",
"gatsby-source-filesystem": "^1.5.18",
"gatsby-transformer-remark": "^1.7.31",
"antd": "^3.6.5",
"atob": "^2.1.1",
"btoa": "^1.2.1",
"gatsby": "^1.9.273",
"gatsby-link": "^1.6.45",
"gatsby-plugin-antd": "^1.0.12",
"gatsby-plugin-google-analytics": "^1.0.31",
"gatsby-plugin-less": "^1.1.8",
"gatsby-plugin-react-helmet": "^2.0.11",
"gatsby-plugin-react-next": "^1.0.11",
"gatsby-remark-prismjs": "^2.0.4",
"gatsby-source-filesystem": "^1.5.39",
"gatsby-transformer-remark": "^1.7.44",
"immutable": "^4.0.0-rc.9",
"react-helmet": "^5.2.0",
"react-syntax-highlighter": "^7.0.0",
"react-syntax-highlighter": "^8.0.0",
"yoga-layout": "^1.9.3"
},
"keywords": [
@@ -31,6 +32,6 @@
"develop": "gatsby develop"
},
"devDependencies": {
"prettier": "1.13.4"
"prettier": "1.13.7"
}
}

View File

@@ -19,6 +19,7 @@ import PositionRecord from './PositionRecord';
import LayoutRecord from './LayoutRecord';
import Sidebar from './Sidebar';
import {Row, Col, Button} from 'antd';
import btoa from 'btoa';
import type {LayoutRecordT} from './LayoutRecord';
import type {Yoga$Direction} from 'yoga-layout';
import './index.css';

View File

@@ -183,12 +183,14 @@ const AboutSectionTwo = () => (
);
export default () => (
<Page className="landing-page" title="A cross-platform layout engine">
<HeroSection />
<PlaygroundSection />
<AboutSectionOne />
<hr />
<AboutSectionTwo />
<Footer />
</Page>
<div>
<Page className="landing-page" title="A cross-platform layout engine">
<HeroSection />
<PlaygroundSection />
<AboutSectionOne />
<hr />
<AboutSectionTwo />
<Footer />
</Page>
</div>
);

File diff suppressed because it is too large Load Diff

View File

@@ -246,9 +246,6 @@ YGNodeRef YGNodeClone(YGNodeRef oldNode) {
node != nullptr,
"Could not allocate memory for node");
oldNode->setChildRoot(node);
for (auto &item : oldNode->getChildren()) {
item->setOwner(nullptr);
}
gNodeInstanceCount++;
node->setOwner(nullptr);
return node;