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 V8SnapshotUtil_h | |
| 6 #define V8SnapshotUtil_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 // V8SnapshotUtil supports handling V8 snapshots. | |
|
haraken
2017/07/06 13:15:54
// This class contains helper functions to take a
Yuki
2017/07/06 14:12:28
s/to take/to take and use/?
Some of helper functi
peria
2017/07/07 06:22:03
Done.
peria
2017/07/07 06:22:03
Acknowledged.
| |
| 18 class CORE_EXPORT V8SnapshotUtil { | |
| 19 STATIC_ONLY(V8SnapshotUtil); | |
| 20 | |
| 21 public: | |
| 22 static v8::Local<v8::Context> CreateContext( | |
| 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::Objects in a context | |
| 29 // created with a snapshot. | |
| 30 static void SetupContext(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 // V8SnapshotUtil_h | |
| OLD | NEW |