• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_D8_PLATFORMS_H_
6 #define V8_D8_D8_PLATFORMS_H_
7 
8 #include <cstdint>
9 #include <memory>
10 
11 namespace v8 {
12 
13 class Isolate;
14 class Platform;
15 
16 // Returns a predictable v8::Platform implementation.
17 // orker threads are disabled, idle tasks are disallowed, and the time reported
18 // by {MonotonicallyIncreasingTime} is deterministic.
19 std::unique_ptr<Platform> MakePredictablePlatform(
20     std::unique_ptr<Platform> platform);
21 
22 // Returns a v8::Platform implementation which randomly delays tasks (both
23 // foreground and background) for stress-testing different interleavings.
24 // If {random_seed} is 0, a random seed is chosen.
25 std::unique_ptr<Platform> MakeDelayedTasksPlatform(
26     std::unique_ptr<Platform> platform, int64_t random_seed);
27 
28 // We use the task queue of {kProcessGlobalPredictablePlatformWorkerTaskQueue}
29 // for worker tasks of the {PredictablePlatform}. At the moment, {nullptr} is a
30 // valid value for the isolate. If this ever changes, we either have to allocate
31 // a core isolate, or refactor the implementation of worker tasks in the
32 // {PredictablePlatform}.
33 constexpr Isolate* kProcessGlobalPredictablePlatformWorkerTaskQueue = nullptr;
34 
35 }  // namespace v8
36 
37 #endif  // V8_D8_D8_PLATFORMS_H_
38