1 | // Copyright 2018 the V8 project authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | #ifndef V8_D8_PLATFORMS_H_ |
6 | #define V8_D8_PLATFORMS_H_ |
7 | |
8 | #include <cstdint> |
9 | #include <memory> |
10 | |
11 | namespace v8 { |
12 | |
13 | class Platform; |
14 | |
15 | // Returns a predictable v8::Platform implementation. |
16 | // orker threads are disabled, idle tasks are disallowed, and the time reported |
17 | // by {MonotonicallyIncreasingTime} is deterministic. |
18 | std::unique_ptr<Platform> MakePredictablePlatform( |
19 | std::unique_ptr<Platform> platform); |
20 | |
21 | // Returns a v8::Platform implementation which randomly delays tasks (both |
22 | // foreground and background) for stress-testing different interleavings. |
23 | // If {random_seed} is 0, a random seed is chosen. |
24 | std::unique_ptr<Platform> MakeDelayedTasksPlatform( |
25 | std::unique_ptr<Platform> platform, int64_t random_seed); |
26 | |
27 | } // namespace v8 |
28 | |
29 | #endif // V8_D8_PLATFORMS_H_ |
30 | |