1 // Copyright 2017 the V8 project 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 V8_SNAPSHOT_PARTIAL_DESERIALIZER_H_
6 #define V8_SNAPSHOT_PARTIAL_DESERIALIZER_H_
7 
8 #include "src/snapshot/deserializer.h"
9 #include "src/snapshot/snapshot.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 class Context;
15 
16 // Deserializes the context-dependent object graph rooted at a given object.
17 // The PartialDeserializer is not expected to deserialize any code objects.
18 class PartialDeserializer final : public Deserializer<> {
19  public:
20   static MaybeHandle<Context> DeserializeContext(
21       Isolate* isolate, const SnapshotData* data, bool can_rehash,
22       Handle<JSGlobalProxy> global_proxy,
23       v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer);
24 
25  private:
PartialDeserializer(const SnapshotData * data)26   explicit PartialDeserializer(const SnapshotData* data)
27       : Deserializer(data, false) {}
28 
29   // Deserialize a single object and the objects reachable from it.
30   MaybeHandle<Object> Deserialize(
31       Isolate* isolate, Handle<JSGlobalProxy> global_proxy,
32       v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer);
33 
34   void DeserializeEmbedderFields(
35       v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer);
36 };
37 
38 }  // namespace internal
39 }  // namespace v8
40 
41 #endif  // V8_SNAPSHOT_PARTIAL_DESERIALIZER_H_
42