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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
"span": "cpp",
"execution": "cpp",
"cassert": "cpp",
"print": "cpp"
"print": "cpp",
"version": "cpp"
},
"cmake.buildDirectory": "${workspaceFolder}/build/targets/darwin",
"C_Cpp.default.cppStandard": "c++17",
Expand Down
2 changes: 1 addition & 1 deletion crates/jsbindings/bindings.layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ namespace crates::layout2
* @tparam defaultValue The default value of the CSS keyword.
*/
template <typename T, T defaultValue>
requires std::is_enum_v<T>
requires std::is_enum_v<T>
class CSSKeyword
{
friend class LayoutStyle;
Expand Down
3 changes: 2 additions & 1 deletion src/bindings/dom/browsing_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "./browsing_context.hpp"

using namespace std;
using namespace endor;

namespace dombinding
{
Expand All @@ -23,7 +24,7 @@ namespace dombinding

BrowsingContext::BrowsingContext(const Napi::CallbackInfo &info)
: RuntimeContextBase<BrowsingContext, dom::BrowsingContext>(info)
, client_context_(TrClientContextPerProcess::Get())
, client_context_(endor::TrClientContextPerProcess::Get())
{
assert(this->contextImpl != nullptr && "contextImpl should not be null");
client_context_->browsingContext = this->contextImpl;
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/dom/browsing_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace dombinding
{
class BrowsingContext : public RuntimeContextBase<BrowsingContext, dom::BrowsingContext>
class BrowsingContext : public RuntimeContextBase<BrowsingContext, endor::dom::BrowsingContext>
{
public:
static void Init(Napi::Env env, Napi::Object exports);
Expand All @@ -20,7 +20,7 @@ namespace dombinding
Napi::Value Start(const Napi::CallbackInfo &info);

private:
TrClientContextPerProcess *client_context_;
endor::TrClientContextPerProcess *client_context_;
static thread_local Napi::FunctionReference *constructor;
};
}
1 change: 1 addition & 0 deletions src/bindings/dom/worker_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "./worker_context.hpp"

using namespace std;
using namespace endor;

namespace dombinding
{
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/dom/worker_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace dombinding
{
class WorkerContext : public RuntimeContextBase<WorkerContext, dom::WorkerContext>
class WorkerContext : public RuntimeContextBase<WorkerContext, endor::dom::WorkerContext>
{
public:
static void Init(Napi::Env env, Napi::Object exports);
Expand Down
3 changes: 3 additions & 0 deletions src/bindings/env/client_context.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "client_context.hpp"
#include "common/xr/types.hpp"

using namespace std;
using namespace endor;

namespace bindings
{
thread_local Napi::FunctionReference *ClientContext::constructor;
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/env/client_context.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <napi.h>
#include "client/per_process.hpp"
#include <client/per_process.hpp>

using namespace std;

Expand All @@ -18,7 +18,7 @@ namespace bindings
Napi::Value FastPerformanceNow(const Napi::CallbackInfo &info);

private:
TrClientContextPerProcess *clientContext = nullptr;
endor::TrClientContextPerProcess *clientContext = nullptr;

private:
static thread_local Napi::FunctionReference *constructor;
Expand Down
4 changes: 3 additions & 1 deletion src/bindings/messaging/event_target.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "./event_target.hpp"

using namespace endor;

namespace bindings
{
namespace messaging
Expand Down Expand Up @@ -45,7 +47,7 @@ namespace bindings
Napi::Env env = info.Env();
Napi::HandleScope scope(env);

clientContext = TrClientContextPerProcess::Get();
clientContext = endor::TrClientContextPerProcess::Get();
if (clientContext == nullptr)
{
Napi::Error::New(env, "The client context is not initialized.").ThrowAsJavaScriptException();
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/messaging/event_target.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace bindings
Napi::Value DispatchEvent(const Napi::CallbackInfo &info);

private:
TrClientContextPerProcess *clientContext;
endor::TrClientContextPerProcess *clientContext;
Napi::ThreadSafeFunction eventListener;
thread eventRecvThread;
bool recvingEvents = false;
Expand Down
3 changes: 3 additions & 0 deletions src/bindings/renderer/animation_frame_listener.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "animation_frame_listener.hpp"

using namespace std;
using namespace endor;

namespace bindings
{
thread_local Napi::FunctionReference *AnimationFrameListener::constructor;
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/renderer/animation_frame_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace bindings

private:
atomic<bool> connected = false;
TrClientContextPerProcess *clientContext = nullptr;
endor::TrClientContextPerProcess *clientContext = nullptr;
Napi::ThreadSafeFunction onframeTsfn;
uv_loop_t *eventloop;
uv_timer_t tickHandle;
Expand Down
23 changes: 13 additions & 10 deletions src/client/animation/animatable.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#include "./animatable.hpp"

namespace dom
namespace endor
{
using namespace std;

Animation &Animatable::animate(Keyframes &keyframes)
namespace dom
{
throw runtime_error("Not implemented");
}
using namespace std;

vector<shared_ptr<Animation>> Animatable::getAnimations(optional<GetAnimationsOptions> options)
{
return {};
Animation &Animatable::animate(Keyframes &keyframes)
{
throw runtime_error("Not implemented");
}

vector<shared_ptr<Animation>> Animatable::getAnimations(optional<GetAnimationsOptions> options)
{
return {};
}
}
}
} // namespace endor
33 changes: 18 additions & 15 deletions src/client/animation/animatable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@
#include "./animation.hpp"
#include "./keyframes.hpp"

namespace dom
namespace endor
{
class Element;

struct GetAnimationsOptions
namespace dom
{
bool subtree;
};
class Element;

class Animatable
{
public:
virtual std::shared_ptr<Element> getAnimationTarget() = 0;
struct GetAnimationsOptions
{
bool subtree;
};

class Animatable
{
public:
virtual std::shared_ptr<Element> getAnimationTarget() = 0;

Animation &animate(Keyframes &keyframes);
std::vector<std::shared_ptr<Animation>> getAnimations(
std::optional<GetAnimationsOptions> options = std::nullopt);
};
}
Animation &animate(Keyframes &keyframes);
std::vector<std::shared_ptr<Animation>> getAnimations(
std::optional<GetAnimationsOptions> options = std::nullopt);
};
}
} // namespace endor
33 changes: 18 additions & 15 deletions src/client/animation/animation-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
#include "./animation.hpp"
#include "./animation_timeline.hpp"

namespace dom
namespace endor
{
template <typename T>
std::shared_ptr<T> Animation::MakeAnimation(std::unique_ptr<AnimationEffect> effect,
std::shared_ptr<AnimationTimeline> timeline)
namespace dom
{
if (TR_UNLIKELY(timeline == nullptr))
return nullptr;

auto deleter = [](T *animation)
template <typename T>
std::shared_ptr<T> Animation::MakeAnimation(std::unique_ptr<AnimationEffect> effect,
std::shared_ptr<AnimationTimeline> timeline)
{
if (TR_LIKELY(animation != nullptr))
delete animation;
};
auto animation = std::shared_ptr<T>(new T(std::move(effect), timeline), deleter);
timeline->animationAttached(animation);
return animation;
if (TR_UNLIKELY(timeline == nullptr))
return nullptr;

auto deleter = [](T *animation)
{
if (TR_LIKELY(animation != nullptr))
delete animation;
};
auto animation = std::shared_ptr<T>(new T(std::move(effect), timeline), deleter);
timeline->animationAttached(animation);
return animation;
}
}
}
} // namespace endor
Loading
Loading