• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INIT_V8_H_
6 #define V8_INIT_V8_H_
7 
8 #include "src/common/globals.h"
9 
10 namespace v8 {
11 
12 class Platform;
13 class StartupData;
14 
15 namespace internal {
16 
17 class Isolate;
18 
19 class V8 : public AllStatic {
20  public:
21   // Global actions.
22   static void Initialize();
23   static void Dispose();
24 
25   // Report process out of memory. Implementation found in api.cc.
26   // This function will not return, but will terminate the execution.
27   // IMPORTANT: Update the Google-internal crash processer if this signature
28   // changes to be able to extract detailed v8::internal::HeapStats on OOM.
29   [[noreturn]] static void FatalProcessOutOfMemory(Isolate* isolate,
30                                                    const char* location,
31                                                    bool is_heap_oom = false);
32 
33 #ifdef V8_SANDBOX
34   static bool InitializeSandbox();
35 #endif
36 
37   static void InitializePlatform(v8::Platform* platform);
38   static void DisposePlatform();
39   V8_EXPORT_PRIVATE static v8::Platform* GetCurrentPlatform();
40   // Replaces the current platform with the given platform.
41   // Should be used only for testing.
42   V8_EXPORT_PRIVATE static void SetPlatformForTesting(v8::Platform* platform);
43 
44   static void SetSnapshotBlob(StartupData* snapshot_blob);
45 
46  private:
47   static v8::Platform* platform_;
48 };
49 
50 }  // namespace internal
51 }  // namespace v8
52 
53 #endif  // V8_INIT_V8_H_
54