Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 92ad9d2

Browse files
committed
chakrashim,src: fixed missing shims
* Added IdleTask and TaskRunner * Re-added v8-debug.h for the chakracore inspector implementation * Re-added min/max macro fixes to HTTP2 * Fixed cpplint issue around comments Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
1 parent 7f06df1 commit 92ad9d2

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

deps/chakrashim/include/v8-platform.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ class Task {
4242
virtual void Run() = 0;
4343
};
4444

45+
class IdleTask {
46+
public:
47+
virtual ~IdleTask() = default;
48+
virtual void Run(double deadline_in_seconds) = 0;
49+
};
50+
51+
class TaskRunner {
52+
public:
53+
virtual void PostTask(std::unique_ptr<Task> task) = 0;
54+
virtual void PostDelayedTask(std::unique_ptr<Task> task,
55+
double delay_in_seconds) = 0;
56+
virtual void PostIdleTask(std::unique_ptr<IdleTask> task) = 0;
57+
virtual bool IdleTasksEnabled() = 0;
58+
59+
TaskRunner() = default;
60+
virtual ~TaskRunner() = default;
61+
62+
private:
63+
TaskRunner(const TaskRunner&) = delete;
64+
TaskRunner& operator=(const TaskRunner&) = delete;
65+
};
66+
4567
/**
4668
* The interface represents complex arguments to trace events.
4769
*/
@@ -101,6 +123,17 @@ class Platform {
101123
virtual ~Platform() = default;
102124

103125
virtual size_t NumberOfAvailableBackgroundThreads() { return 0; }
126+
127+
virtual std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
128+
Isolate* isolate) {
129+
return {};
130+
}
131+
132+
virtual std::shared_ptr<v8::TaskRunner> GetBackgroundTaskRunner(
133+
Isolate* isolate) {
134+
return {};
135+
}
136+
104137
virtual void CallOnBackgroundThread(Task* task,
105138
ExpectedRuntime expected_runtime) = 0;
106139
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0;

deps/chakrashim/src/jsrtutils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ inline size_t _countof(T (&)[N]) {
8282
#define CHAKRA_ASSERT(expr) assert(expr)
8383
#define CHAKRA_UNIMPLEMENTED() jsrt::Unimplemented(__FUNCTION__)
8484
#define CHAKRA_UNIMPLEMENTED_(message) jsrt::Unimplemented(message)
85-
#else // DEBUG
85+
#else // DEBUG
8686
#define CHAKRA_UNIMPLEMENTED() /* no-op */
8787
#define CHAKRA_UNIMPLEMENTED_(message) /* no-op */
8888
#define CHAKRA_ASSERT(expr) /* no-op */
89-
#endif // DEBUG
89+
#endif // DEBUG
9090

9191
#define CHAKRA_VERIFY(expr) if (!(expr)) { \
9292
jsrt::Fatal("internal error %s(%d): %s", __FILE__, __LINE__, #expr); }

src/node.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#if NODE_USE_V8_PLATFORM
6868
#include "libplatform/libplatform.h"
6969
#endif // NODE_USE_V8_PLATFORM
70+
#include "v8-debug.h"
7071
#include "v8-profiler.h"
7172
#include "zlib.h"
7273

src/node_http2.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
#include "node_http2_state.h"
66

77
#include <queue>
8+
9+
// min and max are defined in the PAL, which interferes
10+
// with <algorithm>'s std::min and std::max
11+
#ifdef NODE_ENGINE_CHAKRACORE
12+
#undef min
13+
#undef max
14+
#endif
15+
816
#include <algorithm>
917

1018
namespace node {

0 commit comments

Comments
 (0)