1// Copyright 2011 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_V8_H_
6#define V8_V8_H_
7
8#include "src/globals.h"
9
10namespace v8 {
11
12class Platform;
13class StartupData;
14
15namespace internal {
16
17class Isolate;
18
19class V8 : public AllStatic {
20 public:
21 // Global actions.
22
23 static bool Initialize();
24 static void TearDown();
25
26 // Report process out of memory. Implementation found in api.cc.
27 // This function will not return, but will terminate the execution.
28 [[noreturn]] static void FatalProcessOutOfMemory(Isolate* isolate,
29 const char* location,
30 bool is_heap_oom = false);
31
32 static void InitializePlatform(v8::Platform* platform);
33 static void ShutdownPlatform();
34 V8_EXPORT_PRIVATE static v8::Platform* GetCurrentPlatform();
35 // Replaces the current platform with the given platform.
36 // Should be used only for testing.
37 V8_EXPORT_PRIVATE static void SetPlatformForTesting(v8::Platform* platform);
38
39 static void SetNativesBlob(StartupData* natives_blob);
40 static void SetSnapshotBlob(StartupData* snapshot_blob);
41
42 private:
43 static void InitializeOncePerProcessImpl();
44 static void InitializeOncePerProcess();
45
46 // v8::Platform to use.
47 static v8::Platform* platform_;
48};
49
50} // namespace internal
51} // namespace v8
52
53#endif // V8_V8_H_
54