Skip to content

Commit

Permalink
Initial Bun-specific run loop
Browse files Browse the repository at this point in the history
  • Loading branch information
190n committed Nov 26, 2024
1 parent 8f9ae4f commit 60d90a5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/WTF/wtf/PlatformJSCOnly.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ if (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "glib")
${GLIB_GOBJECT_LIBRARIES}
${GLIB_LIBRARIES}
)
elseif (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "bun")
list(APPEND WTF_SOURCES
bun/RunLoopBun.cpp
)
else ()
list(APPEND WTF_SOURCES
generic/RunLoopGeneric.cpp
Expand Down
1 change: 1 addition & 0 deletions Source/WTF/wtf/RunLoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class WTF_CAPABILITY("is current") RunLoop final : public GuaranteedSerialFuncti

class ScheduledTask;
Ref<ScheduledTask> m_scheduledTask;
#elif USE(BUN_EVENT_LOOP)
#endif
};

Expand Down
39 changes: 39 additions & 0 deletions Source/WTF/wtf/bun/RunLoopBun.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "config.h"
#include <wtf/RunLoop.h>

namespace WTF {

RunLoop::TimerBase::TimerBase(Ref<RunLoop>&& loop)
: m_runLoop(WTFMove(loop))
{
}

RunLoop::TimerBase::~TimerBase()
{
}

void RunLoop::TimerBase::stop() {}

bool RunLoop::TimerBase::isActive() const {}

Seconds RunLoop::TimerBase::secondsUntilFire() const {}

void RunLoop::TimerBase::start(Seconds interval, bool repeat) {}

// probably more Bun-specific TimerBase methods

RunLoop::RunLoop()
{
}

RunLoop::~RunLoop() {}

void RunLoop::run() {}

void RunLoop::stop() {}

void RunLoop::wakeUp() {}

RunLoop::CycleResult RunLoop::cycle(RunLoopMode mode) {}

} // namespace WTF
8 changes: 8 additions & 0 deletions Source/cmake/OptionsJSCOnly.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ WEBKIT_OPTION_END()
set(ALL_EVENT_LOOP_TYPES
GLib
Generic
Bun
)

WEBKIT_OPTION_BEGIN()
Expand All @@ -72,6 +73,10 @@ set(DEFAULT_EVENT_LOOP_TYPE "Generic")

set(EVENT_LOOP_TYPE ${DEFAULT_EVENT_LOOP_TYPE} CACHE STRING "Implementation of event loop to be used in JavaScriptCore (one of ${ALL_EVENT_LOOP_TYPES})")

if (USE_BUN_JSC_ADDITIONS)
set(EVENT_LOOP_TYPE "Bun")
endif ()

set(ENABLE_WEBCORE OFF)
set(ENABLE_WEBKIT_LEGACY OFF)
set(ENABLE_WEBKIT OFF)
Expand Down Expand Up @@ -186,6 +191,9 @@ if (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "glib")
SET_AND_EXPOSE_TO_BUILD(USE_GLIB 1)
SET_AND_EXPOSE_TO_BUILD(USE_GLIB_EVENT_LOOP 1)
SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
elseif (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "bun")
SET_AND_EXPOSE_TO_BUILD(USE_BUN_EVENT_LOOP 1)
SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
else ()
SET_AND_EXPOSE_TO_BUILD(USE_GENERIC_EVENT_LOOP 1)
SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
Expand Down

0 comments on commit 60d90a5

Please sign in to comment.