OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium 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 V8ContextSnapshot_h | |
6 #define V8ContextSnapshot_h | |
7 | |
8 #include "core/CoreExport.h" | |
9 #include "platform/wtf/Allocator.h" | |
10 #include "v8/include/v8.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class Document; | |
15 class DOMWrapperWorld; | |
16 | |
17 // This class contains helper functions to take and use a V8 context snapshot. | |
haraken
2017/07/10 06:52:08
Explain how the V8 context snapshot works. In part
peria
2017/07/10 10:18:43
Done.
| |
18 class CORE_EXPORT V8ContextSnapshot { | |
19 STATIC_ONLY(V8ContextSnapshot); | |
20 | |
21 public: | |
22 static v8::Local<v8::Context> CreateContextFromSnapshot( | |
23 v8::Isolate*, | |
24 const DOMWrapperWorld&, | |
25 v8::ExtensionConfiguration*, | |
26 v8::Local<v8::Object> global_proxy, | |
27 Document*); | |
28 // Install runtime enabled features on some v8::Object's in a context | |
29 // created from a snapshot. | |
30 static void InstallRuntimeEnabledFeatures(v8::Local<v8::Context>, Document*); | |
31 | |
32 static void EnsureInterfaceTemplates(v8::Isolate*); | |
33 | |
34 static void SetReferenceTable(intptr_t* table); | |
35 static intptr_t* GetReferenceTable(); | |
36 | |
37 // Do not call this in production. | |
38 static v8::StartupData TakeSnapshot(); | |
39 | |
40 private: | |
41 static v8::StartupData SerializeInternalField(v8::Local<v8::Object> holder, | |
42 int index, | |
43 void* data); | |
44 static void DeserializeInternalField(v8::Local<v8::Object> holder, | |
45 int index, | |
46 v8::StartupData payload, | |
47 void* data); | |
48 static bool CanCreateContextFromSnapshot(v8::Isolate*, | |
49 const DOMWrapperWorld&, | |
50 Document*); | |
51 | |
52 static void EnsureInterfaceTemplatesForWorld(v8::Isolate*, | |
53 const DOMWrapperWorld&); | |
54 | |
55 static void TakeSnapshotForWorld(v8::SnapshotCreator*, | |
56 const DOMWrapperWorld&); | |
57 }; | |
58 | |
59 } // namespace blink | |
60 | |
61 #endif // V8ContextSnapshot_h | |
OLD | NEW |