Configure JSExector with BundleRegistry instead of JSModulesUnbundle

Differential Revision: D5890458

fbshipit-source-id: 968be95786ffbf53aa98928d4d3e3bd52a84b3dc
This commit is contained in:
Alex Dvornikov
2017-09-22 09:56:50 -07:00
committed by Facebook Github Bot
parent e9aab0d452
commit 7d115730dc
16 changed files with 75 additions and 49 deletions

View File

@@ -8,16 +8,29 @@
#include <utility>
#include <cxxreact/JSModulesUnbundle.h>
#include <jschelpers/noncopyable.h>
#ifndef RN_EXPORT
#define RN_EXPORT __attribute__((visibility("default")))
#endif
namespace facebook {
namespace react {
class RAMBundleRegistry {
class RN_EXPORT RAMBundleRegistry : noncopyable {
public:
constexpr static uint32_t MAIN_BUNDLE_ID = 0;
explicit RAMBundleRegistry(std::unique_ptr<JSModulesUnbundle> mainBundle);
RAMBundleRegistry(RAMBundleRegistry&&) = default;
RAMBundleRegistry& operator=(RAMBundleRegistry&&) = default;
JSModulesUnbundle::Module getModule(uint32_t bundleId, uint32_t moduleId);
virtual ~RAMBundleRegistry() {};
protected:
virtual std::unique_ptr<JSModulesUnbundle> bundleById(uint32_t index) const {
throw std::runtime_error("Please, override this method in a subclass to support multiple RAM bundles.");
}
private:
JSModulesUnbundle *getBundle(uint32_t bundleId) const;