Skip to content

Commit ad88d30

Browse files
committed
Fix Android build
1 parent 309c4d9 commit ad88d30

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

Diff for: Polyfills/Window/Source/TimeoutDispatcher.cpp

+2-22
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,6 @@ namespace Babylon::Polyfills::Internal
1414
}
1515
}
1616

17-
struct TimeoutDispatcher::Timeout
18-
{
19-
TimeoutId id;
20-
21-
// Make this non-shared when JsRuntime::Dispatch supports it.
22-
std::shared_ptr<Napi::FunctionReference> function;
23-
24-
TimePoint time;
25-
26-
Timeout(TimeoutId id, std::shared_ptr<Napi::FunctionReference> function, TimePoint time)
27-
: id{id}
28-
, function{std::move(function)}
29-
, time{time}
30-
{
31-
}
32-
33-
Timeout(const Timeout&) = delete;
34-
Timeout(Timeout&&) = delete;
35-
};
36-
3717
TimeoutDispatcher::TimeoutDispatcher(Babylon::JsRuntime& runtime)
3818
: m_runtimeScheduler{runtime}
3919
, m_thread{std::thread{&TimeoutDispatcher::ThreadFunction, this}}
@@ -56,7 +36,7 @@ namespace Babylon::Polyfills::Internal
5636
m_runtimeScheduler.Rundown();
5737
}
5838

59-
TimeoutDispatcher::TimeoutId TimeoutDispatcher::Dispatch(std::shared_ptr<Napi::FunctionReference> function, std::chrono::milliseconds delay)
39+
TimeoutId TimeoutDispatcher::Dispatch(std::shared_ptr<Napi::FunctionReference> function, std::chrono::milliseconds delay)
6040
{
6141
if (delay.count() < 0)
6242
{
@@ -107,7 +87,7 @@ namespace Babylon::Polyfills::Internal
10787
}
10888
}
10989

110-
TimeoutDispatcher::TimeoutId TimeoutDispatcher::NextTimeoutId()
90+
TimeoutId TimeoutDispatcher::NextTimeoutId()
11191
{
11292
while (true)
11393
{

Diff for: Polyfills/Window/Source/TimeoutDispatcher.h

+22-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313

1414
namespace Babylon::Polyfills::Internal
1515
{
16+
using TimeoutId = int32_t;
17+
1618
class TimeoutDispatcher
1719
{
18-
using TimeoutId = int32_t;
19-
struct Timeout;
20-
2120
public:
2221
TimeoutDispatcher(Babylon::JsRuntime& runtime);
2322
~TimeoutDispatcher();
@@ -28,6 +27,26 @@ namespace Babylon::Polyfills::Internal
2827
private:
2928
using TimePoint = std::chrono::time_point<std::chrono::steady_clock, std::chrono::microseconds>;
3029

30+
struct Timeout
31+
{
32+
TimeoutId id;
33+
34+
// Make this non-shared when JsRuntime::Dispatch supports it.
35+
std::shared_ptr<Napi::FunctionReference> function;
36+
37+
TimePoint time;
38+
39+
Timeout(TimeoutId id, std::shared_ptr<Napi::FunctionReference> function, TimePoint time)
40+
: id{id}
41+
, function{std::move(function)}
42+
, time{time}
43+
{
44+
}
45+
46+
Timeout(const Timeout&) = delete;
47+
Timeout(Timeout&&) = delete;
48+
};
49+
3150
TimeoutId NextTimeoutId();
3251
void ThreadFunction();
3352
void CallFunction(std::shared_ptr<Napi::FunctionReference> function);

Diff for: Polyfills/Window/Source/Window.h

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include <Babylon/JsRuntimeScheduler.h>
44
#include "TimeoutDispatcher.h"
5-
#include <optional>
65

76
namespace Babylon::Polyfills::Internal
87
{

0 commit comments

Comments
 (0)