This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,67 @@
load(
"//tools/build_defs/oss:rn_defs.bzl",
"ANDROID",
"fb_xplat_cxx_test",
"react_native_xplat_target",
"rn_xplat_cxx_library",
"subdir_glob",
)
rn_xplat_cxx_library(
name = "mapbuffer",
srcs = glob(
["**/*.cpp"],
exclude = glob(["tests/**/*.cpp"]),
),
headers = glob(
["**/*.h"],
exclude = glob(["tests/**/*.h"]),
),
header_namespace = "",
exported_headers = subdir_glob(
[
("", "*.h"),
],
prefix = "react",
),
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"],
force_static = True,
macosx_tests_override = [],
platforms = (ANDROID),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
],
tests = [":tests"],
visibility = ["PUBLIC"],
deps = [
"//xplat/fbsystrace:fbsystrace",
"//xplat/folly:headers_only",
"//xplat/folly:memory",
"//xplat/third-party/glog:glog",
react_native_xplat_target("utils:utils"),
],
)
fb_xplat_cxx_test(
name = "tests",
srcs = glob(["tests/**/*.cpp"]),
headers = glob(["tests/**/*.h"]),
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
contacts = ["oncall+react_native@xmail.facebook.com"],
platforms = (ANDROID),
deps = [
"//xplat/folly:molly",
"//xplat/third-party/gmock:gtest",
],
)

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "MapBuffer.h"
namespace facebook {
namespace react {
MapBuffer::MapBuffer() {}
MapBuffer::~MapBuffer() {}
} // namespace react
} // namespace facebook

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <string>
namespace facebook {
namespace react {
/**
* MapBuffer is an optimized map format for transferring data like props between
* C++ and other platforms The implementation of this map is optimized to:
* - be compact to optimize space when sparse (sparse is the common case).
* - be accessible through JNI with zero/minimal copying via ByteBuffer.
* - be Have excellent C++ single-write and many-read performance by maximizing
* CPU cache performance through compactness, data locality, and fixed offsets
* where possible.
* - be optimized for iteration and intersection against other maps, but with
* reasonably good random access as well.
* - Work recursively for nested maps/arrays.
* - Supports dynamic types that map to JSON.
* - Don't require mutability - single-write on creation.
* - have minimal APK size and build time impact.
*/
class MapBuffer {
public:
MapBuffer();
virtual ~MapBuffer();
};
} // namespace react
} // namespace facebook

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <memory>
#include <gtest/gtest.h>
TEST(MapBufferTest, testSomething) {
// TODO
}