OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_V8_H_ | 5 #ifndef V8_V8_H_ |
6 #define V8_V8_H_ | 6 #define V8_V8_H_ |
7 | 7 |
8 #include "include/v8.h" | 8 #include "include/v8.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 class V8 : public AllStatic { | 14 class V8 : public AllStatic { |
15 public: | 15 public: |
16 // Global actions. | 16 // Global actions. |
17 | 17 |
18 static bool Initialize(); | 18 static bool Initialize(); |
19 static void TearDown(); | 19 static void TearDown(); |
20 | 20 |
21 // Report process out of memory. Implementation found in api.cc. | 21 // Report process out of memory. Implementation found in api.cc. |
22 // This function will not return, but will terminate the execution. | 22 // This function will not return, but will terminate the execution. |
23 static void FatalProcessOutOfMemory(const char* location, | 23 static void FatalProcessOutOfMemory(const char* location, |
24 bool take_snapshot = false); | 24 bool take_snapshot = false); |
25 | 25 |
26 static void InitializePlatform(v8::Platform* platform); | 26 static void InitializePlatform(v8::Platform* platform); |
27 static void ShutdownPlatform(); | 27 static void ShutdownPlatform(); |
28 static v8::Platform* GetCurrentPlatform(); | 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); |
29 | 32 |
30 static void SetNativesBlob(StartupData* natives_blob); | 33 static void SetNativesBlob(StartupData* natives_blob); |
31 static void SetSnapshotBlob(StartupData* snapshot_blob); | 34 static void SetSnapshotBlob(StartupData* snapshot_blob); |
32 | 35 |
33 private: | 36 private: |
34 static void InitializeOncePerProcessImpl(); | 37 static void InitializeOncePerProcessImpl(); |
35 static void InitializeOncePerProcess(); | 38 static void InitializeOncePerProcess(); |
36 | 39 |
37 // v8::Platform to use. | 40 // v8::Platform to use. |
38 static v8::Platform* platform_; | 41 static v8::Platform* platform_; |
39 }; | 42 }; |
40 | 43 |
41 } } // namespace v8::internal | 44 } } // namespace v8::internal |
42 | 45 |
43 #endif // V8_V8_H_ | 46 #endif // V8_V8_H_ |
OLD | NEW |