Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions driver/js/include/driver/scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ class Scope : public std::enable_shared_from_this<Scope> {
Scope(std::weak_ptr<Engine> engine,
std::string name);
~Scope();

inline void SetScopeId(uint32_t scope_id) {
scope_id_ = scope_id;
}

inline uint32_t GetScopeId() {
return scope_id_;
}
Expand Down Expand Up @@ -374,7 +374,10 @@ class Scope : public std::enable_shared_from_this<Scope> {
auto any_pointer = std::any_cast<void*>(&slot_any);
auto scope_wrapper = reinterpret_cast<ScopeWrapper*>(static_cast<void *>(*any_pointer));
auto scope = scope_wrapper->scope.lock();
FOOTSTONE_CHECK(scope);
FOOTSTONE_DCHECK(scope);
if (!scope || !scope->GetEngine().lock()) {
return;
}
auto context = scope->GetContext();

auto class_template = reinterpret_cast<ClassTemplate<T>*>(data);
Expand Down
5 changes: 4 additions & 1 deletion driver/js/src/modules/timer_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ std::shared_ptr<hippy::napi::CtxValue> TimerModule::Start(CallbackInfo& info, bo
auto any_pointer = std::any_cast<void*>(&slot_any);
auto scope_wrapper = reinterpret_cast<ScopeWrapper*>(static_cast<void *>(*any_pointer));
auto scope = scope_wrapper->scope.lock();
FOOTSTONE_CHECK(scope);
FOOTSTONE_DCHECK(scope);
if (!scope || !scope->GetEngine().lock()) {
return nullptr;
}
auto context = scope->GetContext();
FOOTSTONE_CHECK(context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,10 @@ jint CreateJsDriver(JNIEnv* j_env,
hippy::bridge::CallJavaMethod(java_callback->GetObj(), INIT_CB_STATE::SUCCESS);
{
std::unique_lock<std::mutex> lock(scope_mutex);
scope_initialized_map[scope_id] = true;
scope_cv_map[scope_id]->notify_all();
if (scope_initialized_map.find(scope_id) != scope_initialized_map.end()) {
scope_initialized_map[scope_id] = true;
scope_cv_map[scope_id]->notify_all();
}
}
};
auto engine = JsDriverUtils::CreateEngineAndAsyncInitialize(
Expand Down
Loading