Skip to content

Commit 60d90a5

Browse files
author
Ben Grant
committed
Initial Bun-specific run loop
1 parent 8f9ae4f commit 60d90a5

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

Source/WTF/wtf/PlatformJSCOnly.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ if (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "glib")
128128
${GLIB_GOBJECT_LIBRARIES}
129129
${GLIB_LIBRARIES}
130130
)
131+
elseif (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "bun")
132+
list(APPEND WTF_SOURCES
133+
bun/RunLoopBun.cpp
134+
)
131135
else ()
132136
list(APPEND WTF_SOURCES
133137
generic/RunLoopGeneric.cpp

Source/WTF/wtf/RunLoop.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class WTF_CAPABILITY("is current") RunLoop final : public GuaranteedSerialFuncti
171171

172172
class ScheduledTask;
173173
Ref<ScheduledTask> m_scheduledTask;
174+
#elif USE(BUN_EVENT_LOOP)
174175
#endif
175176
};
176177

Source/WTF/wtf/bun/RunLoopBun.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include "config.h"
2+
#include <wtf/RunLoop.h>
3+
4+
namespace WTF {
5+
6+
RunLoop::TimerBase::TimerBase(Ref<RunLoop>&& loop)
7+
: m_runLoop(WTFMove(loop))
8+
{
9+
}
10+
11+
RunLoop::TimerBase::~TimerBase()
12+
{
13+
}
14+
15+
void RunLoop::TimerBase::stop() {}
16+
17+
bool RunLoop::TimerBase::isActive() const {}
18+
19+
Seconds RunLoop::TimerBase::secondsUntilFire() const {}
20+
21+
void RunLoop::TimerBase::start(Seconds interval, bool repeat) {}
22+
23+
// probably more Bun-specific TimerBase methods
24+
25+
RunLoop::RunLoop()
26+
{
27+
}
28+
29+
RunLoop::~RunLoop() {}
30+
31+
void RunLoop::run() {}
32+
33+
void RunLoop::stop() {}
34+
35+
void RunLoop::wakeUp() {}
36+
37+
RunLoop::CycleResult RunLoop::cycle(RunLoopMode mode) {}
38+
39+
} // namespace WTF

Source/cmake/OptionsJSCOnly.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ WEBKIT_OPTION_END()
5858
set(ALL_EVENT_LOOP_TYPES
5959
GLib
6060
Generic
61+
Bun
6162
)
6263

6364
WEBKIT_OPTION_BEGIN()
@@ -72,6 +73,10 @@ set(DEFAULT_EVENT_LOOP_TYPE "Generic")
7273

7374
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})")
7475

76+
if (USE_BUN_JSC_ADDITIONS)
77+
set(EVENT_LOOP_TYPE "Bun")
78+
endif ()
79+
7580
set(ENABLE_WEBCORE OFF)
7681
set(ENABLE_WEBKIT_LEGACY OFF)
7782
set(ENABLE_WEBKIT OFF)
@@ -186,6 +191,9 @@ if (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "glib")
186191
SET_AND_EXPOSE_TO_BUILD(USE_GLIB 1)
187192
SET_AND_EXPOSE_TO_BUILD(USE_GLIB_EVENT_LOOP 1)
188193
SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
194+
elseif (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "bun")
195+
SET_AND_EXPOSE_TO_BUILD(USE_BUN_EVENT_LOOP 1)
196+
SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
189197
else ()
190198
SET_AND_EXPOSE_TO_BUILD(USE_GENERIC_EVENT_LOOP 1)
191199
SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)

0 commit comments

Comments
 (0)