Chromium Code Reviews| 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 V8SnapshotCreator_h | |
| 6 #define V8SnapshotCreator_h | |
| 7 | |
| 8 #include "core/CoreExport.h" | |
| 9 #include "platform/bindings/V8Binding.h" | |
| 10 #include "v8/include/v8.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class Document; | |
| 15 | |
| 16 class CORE_EXPORT V8SnapshotCreator { | |
|
haraken
2017/05/20 19:10:02
Most methods of V8SnapshotCreator are taking an Is
peria
2017/06/01 08:33:32
V8PerIsolateData cannot depend on core/, and most
| |
| 17 STATIC_ONLY(V8SnapshotCreator); | |
| 18 | |
| 19 public: | |
| 20 struct DataForDeserializer { | |
| 21 STACK_ALLOCATED(); | |
| 22 Member<Document> document; | |
| 23 }; | |
| 24 | |
| 25 // Methods to take a snapshot of V8 context for Blink. | |
| 26 static v8::StartupData TakeSnapshot(v8::SnapshotCreator*); | |
| 27 static v8::SnapshotCreator* GetSnapshotCreator(); | |
| 28 static v8::StartupData SerializeInternalField(v8::Local<v8::Object> holder, | |
| 29 int index, | |
| 30 void* data); | |
| 31 | |
| 32 static void DeserializeInternalField(v8::Local<v8::Object> holder, | |
| 33 int index, | |
| 34 v8::StartupData payload, | |
| 35 void* data); | |
| 36 static v8::Local<v8::Context> CreateContext( | |
| 37 v8::Isolate*, | |
| 38 const DOMWrapperWorld&, | |
| 39 v8::ExtensionConfiguration*, | |
| 40 v8::Local<v8::Object> global_proxy, | |
| 41 Document*); | |
| 42 | |
| 43 static void EnsureInterfaceTemplates(v8::Isolate*, const DOMWrapperWorld&); | |
| 44 static v8::Local<v8::FunctionTemplate> CreateInterfaceTemplate( | |
| 45 v8::Isolate*, | |
| 46 const DOMWrapperWorld&, | |
| 47 WrapperTypeInfo*); | |
| 48 | |
| 49 // Install runtime enabled features which are not installed in snapshot. | |
| 50 static void InstallRuntimeEnabledFeaturesOnDocument( | |
| 51 ScriptState*, | |
| 52 v8::Local<v8::Object> document_wrapper); | |
| 53 static void InstallRuntimeEnabledFeaturesOnGlobal( | |
| 54 ScriptState*, | |
| 55 v8::Local<v8::Object> global); | |
| 56 | |
| 57 // In creating V8 context snapshot or not | |
| 58 static bool TakingSnapshot(); | |
| 59 static void SetTakingSnapshot(bool); | |
| 60 | |
| 61 static void SetReferenceTable(intptr_t* table); | |
| 62 static intptr_t* GetReferenceTable(); | |
| 63 | |
| 64 private: | |
| 65 static void TakeSnapshotForWorld(v8::SnapshotCreator*, | |
| 66 const DOMWrapperWorld&); | |
| 67 }; | |
| 68 | |
| 69 } // namespace blink | |
| 70 | |
| 71 #endif // V8SnapshotCreator_h | |
| OLD | NEW |