mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
722feeb02b
Summary: Changelog: [General] [Fixed] - License header cleanup Reviewed By: yungsters Differential Revision: D17952695 fbshipit-source-id: 81aa607612ba1357ef7814ef20371335151afe7e
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
/*
|
|
* 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 <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#include <cxxreact/JSBigString.h>
|
|
#include <cxxreact/JSModulesUnbundle.h>
|
|
#include <folly/dynamic.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class JSDeltaBundleClient {
|
|
public:
|
|
void patch(const folly::dynamic& delta);
|
|
JSModulesUnbundle::Module getModule(uint32_t moduleId) const;
|
|
std::unique_ptr<const JSBigString> getStartupCode() const;
|
|
void clear();
|
|
|
|
private:
|
|
std::unordered_map<uint32_t, std::string> modules_;
|
|
std::string startupCode_;
|
|
|
|
void patchModules(const folly::dynamic *delta);
|
|
};
|
|
|
|
class JSDeltaBundleClientRAMBundle : public JSModulesUnbundle {
|
|
public:
|
|
JSDeltaBundleClientRAMBundle(
|
|
std::shared_ptr<const JSDeltaBundleClient> client) : client_(client) {}
|
|
|
|
Module getModule(uint32_t moduleId) const override {
|
|
return client_->getModule(moduleId);
|
|
}
|
|
private:
|
|
const std::shared_ptr<const JSDeltaBundleClient> client_;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|