mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Replace folly::make_unique with std::make_unique (#26730)
Summary: There is a mixed usage of `folly::make_unique` and `std::make_unique`. Soon, `folly::make_unique` may be removed (see [this PR](https://github.com/facebook/folly/pull/1150)). Since `react-native` only supports C++14-compilers and later, switch to always using `std::make_unique`. ## Changelog [Internal] [Removed] - Replace folly::make_unique with std::make_unique Pull Request resolved: https://github.com/facebook/react-native/pull/26730 Test Plan: Running the existing test suite. No change in behavior is expected. Joshua Gross: buck install -r fb4a, make sure MP Home and forced teardown works okay on android Reviewed By: shergin Differential Revision: D18062400 Pulled By: JoshuaGross fbshipit-source-id: 978ca794c7e972db872a8dcc57c31bdec7451481
This commit is contained in:
committed by
Facebook Github Bot
parent
468d1a2d2e
commit
ba18ee9b87
@@ -8,7 +8,6 @@
|
||||
#include <../instrumentation/HermesMemoryDumper.h>
|
||||
#include <HermesExecutorFactory.h>
|
||||
#include <fb/fbjni.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <hermes/Public/GCConfig.h>
|
||||
#include <hermes/Public/RuntimeConfig.h>
|
||||
#include <jni.h>
|
||||
@@ -16,6 +15,8 @@
|
||||
#include <react/jni/JSLogging.h>
|
||||
#include <react/jni/JavaScriptExecutorHolder.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
@@ -103,7 +104,7 @@ class HermesExecutorHolder
|
||||
JReactMarker::setLogPerfMarkerIfNeeded();
|
||||
|
||||
return makeCxxInstance(
|
||||
folly::make_unique<HermesExecutorFactory>(installBindings));
|
||||
std::make_unique<HermesExecutorFactory>(installBindings));
|
||||
}
|
||||
|
||||
static jni::local_ref<jhybriddata> initHybrid(
|
||||
@@ -124,7 +125,7 @@ class HermesExecutorHolder
|
||||
heapDumper,
|
||||
tripWireCooldownMS,
|
||||
tripWireLimitBytes);
|
||||
return makeCxxInstance(folly::make_unique<HermesExecutorFactory>(
|
||||
return makeCxxInstance(std::make_unique<HermesExecutorFactory>(
|
||||
installBindings, JSIExecutor::defaultTimeoutInvoker, runtimeConfig));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include <fb/fbjni.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <jsi/JSCRuntime.h>
|
||||
#include <jsireact/JSIExecutor.h>
|
||||
#include <react/jni/JReactMarker.h>
|
||||
@@ -14,6 +13,8 @@
|
||||
#include <react/jni/JavaScriptExecutorHolder.h>
|
||||
#include <react/jni/ReadableNativeMap.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
@@ -30,7 +31,7 @@ class JSCExecutorFactory : public JSExecutorFactory {
|
||||
&reactAndroidLoggingHook);
|
||||
react::bindNativeLogger(runtime, androidLogger);
|
||||
};
|
||||
return folly::make_unique<JSIExecutor>(
|
||||
return std::make_unique<JSIExecutor>(
|
||||
jsc::makeJSCRuntime(),
|
||||
delegate,
|
||||
JSIExecutor::defaultTimeoutInvoker,
|
||||
@@ -56,7 +57,7 @@ class JSCExecutorHolder
|
||||
// Android.
|
||||
JReactMarker::setLogPerfMarkerIfNeeded();
|
||||
// TODO mhorowitz T28461666 fill in some missing nice to have glue
|
||||
return makeCxxInstance(folly::make_unique<JSCExecutorFactory>());
|
||||
return makeCxxInstance(std::make_unique<JSCExecutorFactory>());
|
||||
}
|
||||
|
||||
static void registerNatives() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "CatalystInstanceImpl.h"
|
||||
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
@@ -25,7 +26,6 @@
|
||||
#include <cxxreact/RecoverableError.h>
|
||||
#include <fb/fbjni/ByteBuffer.h>
|
||||
#include <fb/log.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <folly/dynamic.h>
|
||||
#include <jni/Countable.h>
|
||||
#include <jni/LocalReference.h>
|
||||
@@ -93,7 +93,7 @@ CatalystInstanceImpl::initHybrid(jni::alias_ref<jclass>) {
|
||||
}
|
||||
|
||||
CatalystInstanceImpl::CatalystInstanceImpl()
|
||||
: instance_(folly::make_unique<Instance>()) {}
|
||||
: instance_(std::make_unique<Instance>()) {}
|
||||
|
||||
CatalystInstanceImpl::~CatalystInstanceImpl() {
|
||||
if (moduleMessageQueue_ != NULL) {
|
||||
@@ -181,7 +181,7 @@ void CatalystInstanceImpl::initializeBridge(
|
||||
instance_->initializeBridge(
|
||||
std::make_unique<JInstanceCallback>(callback, moduleMessageQueue_),
|
||||
jseh->getExecutorFactory(),
|
||||
folly::make_unique<JMessageQueueThread>(jsQueue),
|
||||
std::make_unique<JMessageQueueThread>(jsQueue),
|
||||
moduleRegistry_);
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ void CatalystInstanceImpl::setGlobalVariable(
|
||||
|
||||
instance_->setGlobalVariable(
|
||||
std::move(propName),
|
||||
folly::make_unique<JSBigStdString>(std::move(jsonValue)));
|
||||
std::make_unique<JSBigStdString>(std::move(jsonValue)));
|
||||
}
|
||||
|
||||
jlong CatalystInstanceImpl::getJavaScriptContext() {
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <ReactCommon/BridgeJSCallInvoker.h>
|
||||
#include <ReactCommon/CallInvokerHolder.h>
|
||||
#include <fb/fbjni.h>
|
||||
#include <folly/Memory.h>
|
||||
|
||||
#include "CxxModuleWrapper.h"
|
||||
#include "JMessageQueueThread.h"
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "JInspector.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#ifdef WITH_INSPECTOR
|
||||
|
||||
namespace facebook {
|
||||
@@ -80,7 +82,7 @@ jni::local_ref<jni::JArrayClass<JPage::javaobject>> JInspector::getPages() {
|
||||
}
|
||||
|
||||
jni::local_ref<JLocalConnection::javaobject> JInspector::connect(int pageId, jni::alias_ref<JRemoteConnection::javaobject> remote) {
|
||||
auto localConnection = inspector_->connect(pageId, folly::make_unique<RemoteConnection>(std::move(remote)));
|
||||
auto localConnection = inspector_->connect(pageId, std::make_unique<RemoteConnection>(std::move(remote)));
|
||||
return JLocalConnection::newObjectCxxArgs(std::move(localConnection));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
#include <jsinspector/InspectorInterfaces.h>
|
||||
|
||||
#include <fb/fbjni.h>
|
||||
#include <folly/Memory.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include <fb/fbjni.h>
|
||||
#include <fb/log.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <jsi/jsi.h>
|
||||
|
||||
#include "JNativeRunnable.h"
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include <fb/fbjni.h>
|
||||
#include <fb/log.h>
|
||||
#include <folly/Conv.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
@@ -48,7 +48,7 @@ std::unique_ptr<const JSBigString> loadScriptFromAssets(
|
||||
assetName.c_str(),
|
||||
AASSET_MODE_STREAMING); // Optimized for sequential read: see AssetManager.java for docs
|
||||
if (asset) {
|
||||
auto buf = folly::make_unique<JSBigBufferString>(AAsset_getLength(asset));
|
||||
auto buf = std::make_unique<JSBigBufferString>(AAsset_getLength(asset));
|
||||
size_t offset = 0;
|
||||
int readbytes;
|
||||
while ((readbytes = AAsset_read(asset, buf->data() + offset, buf->size() - offset)) > 0) {
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <sys/endian.h>
|
||||
#include <utility>
|
||||
|
||||
#include <folly/Memory.h>
|
||||
|
||||
using magic_number_t = uint32_t;
|
||||
const magic_number_t MAGIC_FILE_HEADER = 0xFB0BD1E5;
|
||||
const char* MAGIC_FILE_NAME = "UNBUNDLE";
|
||||
@@ -46,7 +44,7 @@ static asset_ptr openAsset(
|
||||
std::unique_ptr<JniJSModulesUnbundle> JniJSModulesUnbundle::fromEntryFile(
|
||||
AAssetManager *assetManager,
|
||||
const std::string& entryFile) {
|
||||
return folly::make_unique<JniJSModulesUnbundle>(assetManager, jsModulesDir(entryFile));
|
||||
return std::make_unique<JniJSModulesUnbundle>(assetManager, jsModulesDir(entryFile));
|
||||
}
|
||||
|
||||
JniJSModulesUnbundle::JniJSModulesUnbundle(AAssetManager *assetManager, const std::string& moduleDirectory) :
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
#include "ModuleRegistryBuilder.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <cxxreact/CxxNativeModule.h>
|
||||
#include <folly/Memory.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
@@ -47,14 +47,14 @@ std::vector<std::unique_ptr<NativeModule>> buildNativeModuleList(
|
||||
std::vector<std::unique_ptr<NativeModule>> modules;
|
||||
if (javaModules) {
|
||||
for (const auto& jm : *javaModules) {
|
||||
modules.emplace_back(folly::make_unique<JavaNativeModule>(
|
||||
modules.emplace_back(std::make_unique<JavaNativeModule>(
|
||||
winstance, jm, moduleMessageQueue));
|
||||
}
|
||||
}
|
||||
if (cxxModules) {
|
||||
for (const auto& cm : *cxxModules) {
|
||||
std::string moduleName = cm->getName();
|
||||
modules.emplace_back(folly::make_unique<CxxNativeModule>(
|
||||
modules.emplace_back(std::make_unique<CxxNativeModule>(
|
||||
winstance, moduleName, cm->getProvider(moduleName), moduleMessageQueue));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
#include <fb/assert.h>
|
||||
#include <fb/Environment.h>
|
||||
#include <folly/json.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <jni/LocalReference.h>
|
||||
#include <jni/LocalString.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
@@ -38,7 +39,7 @@ static std::string executeJSCallWithProxy(
|
||||
|
||||
std::unique_ptr<JSExecutor> ProxyExecutorOneTimeFactory::createJSExecutor(
|
||||
std::shared_ptr<ExecutorDelegate> delegate, std::shared_ptr<MessageQueueThread>) {
|
||||
return folly::make_unique<ProxyExecutor>(std::move(m_executor), delegate);
|
||||
return std::make_unique<ProxyExecutor>(std::move(m_executor), delegate);
|
||||
}
|
||||
|
||||
ProxyExecutor::ProxyExecutor(jni::global_ref<jobject>&& executorInstance,
|
||||
@@ -74,7 +75,7 @@ void ProxyExecutor::loadApplicationScript(
|
||||
SystraceSection t("setGlobalVariable");
|
||||
setGlobalVariable(
|
||||
"__fbBatchedBridgeConfig",
|
||||
folly::make_unique<JSBigStdString>(folly::toJson(config)));
|
||||
std::make_unique<JSBigStdString>(folly::toJson(config)));
|
||||
}
|
||||
|
||||
static auto loadApplicationScript =
|
||||
|
||||
Reference in New Issue
Block a user