2011-06-16 06:37:49 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#ifndef V8_V8_H_
|
|
|
|
#define V8_V8_H_
|
|
|
|
|
2015-08-20 09:24:24 +00:00
|
|
|
#include "include/v8.h"
|
|
|
|
#include "src/allocation.h"
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
class V8 : public AllStatic {
|
|
|
|
public:
|
|
|
|
// Global actions.
|
|
|
|
|
2014-09-19 08:01:35 +00:00
|
|
|
static bool Initialize();
|
2013-10-02 09:01:40 +00:00
|
|
|
static void TearDown();
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Report process out of memory. Implementation found in api.cc.
|
2015-02-05 09:51:53 +00:00
|
|
|
// This function will not return, but will terminate the execution.
|
2010-08-05 14:12:50 +00:00
|
|
|
static void FatalProcessOutOfMemory(const char* location,
|
|
|
|
bool take_snapshot = false);
|
2009-06-15 08:04:47 +00:00
|
|
|
|
2013-11-21 14:07:06 +00:00
|
|
|
static void InitializePlatform(v8::Platform* platform);
|
|
|
|
static void ShutdownPlatform();
|
|
|
|
static v8::Platform* GetCurrentPlatform();
|
2015-09-08 15:54:24 +00:00
|
|
|
// Replaces the current platform with the given platform.
|
|
|
|
// Should be used only for testing.
|
|
|
|
static void SetPlatformForTesting(v8::Platform* platform);
|
2013-11-21 14:07:06 +00:00
|
|
|
|
2014-11-24 12:44:34 +00:00
|
|
|
static void SetNativesBlob(StartupData* natives_blob);
|
|
|
|
static void SetSnapshotBlob(StartupData* snapshot_blob);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2012-03-12 13:56:56 +00:00
|
|
|
static void InitializeOncePerProcessImpl();
|
2011-03-31 16:17:37 +00:00
|
|
|
static void InitializeOncePerProcess();
|
|
|
|
|
2013-11-21 14:07:06 +00:00
|
|
|
// v8::Platform to use.
|
|
|
|
static v8::Platform* platform_;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2015-09-30 13:46:56 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#endif // V8_V8_H_
|