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