react-native-nitro-modules 0.33.5 → 0.33.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cpp/core/AnyMap.cpp
CHANGED
|
@@ -164,28 +164,28 @@ AnyValue AnyMap::getAny(const std::string& key) const {
|
|
|
164
164
|
|
|
165
165
|
// Set
|
|
166
166
|
void AnyMap::setNull(const std::string& key) {
|
|
167
|
-
_map.
|
|
167
|
+
_map.insert_or_assign(key, nitro::null);
|
|
168
168
|
}
|
|
169
169
|
void AnyMap::setDouble(const std::string& key, double value) {
|
|
170
|
-
_map.
|
|
170
|
+
_map.insert_or_assign(key, value);
|
|
171
171
|
}
|
|
172
172
|
void AnyMap::setBoolean(const std::string& key, bool value) {
|
|
173
|
-
_map.
|
|
173
|
+
_map.insert_or_assign(key, value);
|
|
174
174
|
}
|
|
175
175
|
void AnyMap::setBigInt(const std::string& key, int64_t value) {
|
|
176
|
-
_map.
|
|
176
|
+
_map.insert_or_assign(key, value);
|
|
177
177
|
}
|
|
178
178
|
void AnyMap::setString(const std::string& key, const std::string& value) {
|
|
179
|
-
_map.
|
|
179
|
+
_map.insert_or_assign(key, value);
|
|
180
180
|
}
|
|
181
181
|
void AnyMap::setArray(const std::string& key, const AnyArray& value) {
|
|
182
|
-
_map.
|
|
182
|
+
_map.insert_or_assign(key, value);
|
|
183
183
|
}
|
|
184
184
|
void AnyMap::setObject(const std::string& key, const AnyObject& value) {
|
|
185
|
-
_map.
|
|
185
|
+
_map.insert_or_assign(key, value);
|
|
186
186
|
}
|
|
187
187
|
void AnyMap::setAny(const std::string& key, const AnyValue& value) {
|
|
188
|
-
_map.
|
|
188
|
+
_map.insert_or_assign(key, value);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
// C++ getter
|
|
@@ -60,16 +60,12 @@ public:
|
|
|
60
60
|
static std::shared_ptr<Prototype> get(const NativeInstanceId& typeId, const std::shared_ptr<Prototype>& base = nullptr) {
|
|
61
61
|
static std::unordered_map<NativeInstanceId, std::shared_ptr<Prototype>> _prototypesCache;
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
// We know this C++ type ID / Prototype - return it!
|
|
66
|
-
return found->second;
|
|
67
|
-
} else {
|
|
63
|
+
auto [it, inserted] = _prototypesCache.try_emplace(typeId);
|
|
64
|
+
if (inserted) {
|
|
68
65
|
// This is the first time we see this C++ type ID - create a new base Prototype for this.
|
|
69
|
-
|
|
70
|
-
_prototypesCache.emplace(typeId, prototype);
|
|
71
|
-
return prototype;
|
|
66
|
+
it->second = std::shared_ptr<Prototype>(new Prototype(typeId, base));
|
|
72
67
|
}
|
|
68
|
+
return it->second;
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
public:
|
|
@@ -64,12 +64,12 @@ void ThreadPool::run(std::function<void()>&& task) {
|
|
|
64
64
|
}
|
|
65
65
|
// New scope because of RAII lock
|
|
66
66
|
{
|
|
67
|
-
// lock on the mutex - we want to
|
|
67
|
+
// lock on the mutex - we want to push the task back in the queue
|
|
68
68
|
std::unique_lock<std::mutex> lock(_queueMutex);
|
|
69
69
|
if (!_isAlive) {
|
|
70
70
|
throw std::runtime_error("Cannot queue the given task - the ThreadPool has already been stopped!");
|
|
71
71
|
}
|
|
72
|
-
_tasks.
|
|
72
|
+
_tasks.push(std::move(task));
|
|
73
73
|
}
|
|
74
74
|
// Notify about a new task - one of the workers will pick it up
|
|
75
75
|
_condition.notify_one();
|
|
@@ -33,7 +33,7 @@ const jsi::PropNameID& PropNameIDCache::get(jsi::Runtime& runtime, const std::st
|
|
|
33
33
|
auto sharedPropName = jsiCache.makeShared(std::move(propName));
|
|
34
34
|
|
|
35
35
|
// store it in cache...
|
|
36
|
-
cache.
|
|
36
|
+
cache.insert_or_assign(value, sharedPropName);
|
|
37
37
|
|
|
38
38
|
// return it!
|
|
39
39
|
return *sharedPropName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-modules",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.7",
|
|
4
4
|
"description": "Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|