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