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:
Joe Loser
2019-10-22 12:21:41 -07:00
committed by Facebook Github Bot
parent 468d1a2d2e
commit ba18ee9b87
20 changed files with 412 additions and 341 deletions
+13 -14
View File
@@ -7,25 +7,24 @@
#include "JSDeltaBundleClient.h"
#include <memory>
#include <sstream>
#include <folly/Memory.h>
namespace facebook {
namespace react {
namespace {
std::string startupCode(const folly::dynamic *pre, const folly::dynamic *post) {
std::ostringstream startupCode;
std::string startupCode(const folly::dynamic *pre, const folly::dynamic *post) {
std::ostringstream startupCode;
for (auto section : {pre, post}) {
if (section != nullptr) {
startupCode << section->getString() << '\n';
}
for (auto section : {pre, post}) {
if (section != nullptr) {
startupCode << section->getString() << '\n';
}
return startupCode.str();
}
return startupCode.str();
}
} // namespace
void JSDeltaBundleClient::patchModules(const folly::dynamic *modules) {
@@ -36,7 +35,7 @@ void JSDeltaBundleClient::patchModules(const folly::dynamic *modules) {
}
}
void JSDeltaBundleClient::patch(const folly::dynamic& delta) {
void JSDeltaBundleClient::patch(const folly::dynamic &delta) {
auto const base = delta.get_ptr("base");
if (base != nullptr && base->asBool()) {
@@ -76,10 +75,10 @@ void JSDeltaBundleClient::patch(const folly::dynamic& delta) {
patchModules(modified);
}
}
}
JSModulesUnbundle::Module JSDeltaBundleClient::getModule(uint32_t moduleId) const {
JSModulesUnbundle::Module JSDeltaBundleClient::getModule(
uint32_t moduleId) const {
auto search = modules_.find(moduleId);
if (search != modules_.end()) {
return {folly::to<std::string>(search->first, ".js"), search->second};
@@ -89,7 +88,7 @@ JSModulesUnbundle::Module JSDeltaBundleClient::getModule(uint32_t moduleId) cons
}
std::unique_ptr<const JSBigString> JSDeltaBundleClient::getStartupCode() const {
return folly::make_unique<JSBigStdString>(startupCode_);
return std::make_unique<JSBigStdString>(startupCode_);
}
void JSDeltaBundleClient::clear() {