Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Side by Side Diff: include/v8.h

Issue 2619203002: [serializer] pass internal fields deserializer callback as argument. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 6289 matching lines...) Expand 10 before | Expand all | Expand 10 after
6300 */ 6300 */
6301 struct CreateParams { 6301 struct CreateParams {
6302 CreateParams() 6302 CreateParams()
6303 : entry_hook(nullptr), 6303 : entry_hook(nullptr),
6304 code_event_handler(nullptr), 6304 code_event_handler(nullptr),
6305 snapshot_blob(nullptr), 6305 snapshot_blob(nullptr),
6306 counter_lookup_callback(nullptr), 6306 counter_lookup_callback(nullptr),
6307 create_histogram_callback(nullptr), 6307 create_histogram_callback(nullptr),
6308 add_histogram_sample_callback(nullptr), 6308 add_histogram_sample_callback(nullptr),
6309 array_buffer_allocator(nullptr), 6309 array_buffer_allocator(nullptr),
6310 external_references(nullptr), 6310 external_references(nullptr) {}
6311 deserialize_internal_fields_callback(nullptr) {}
6312 6311
6313 /** 6312 /**
6314 * The optional entry_hook allows the host application to provide the 6313 * The optional entry_hook allows the host application to provide the
6315 * address of a function that's invoked on entry to every V8-generated 6314 * address of a function that's invoked on entry to every V8-generated
6316 * function. Note that entry_hook is invoked at the very start of each 6315 * function. Note that entry_hook is invoked at the very start of each
6317 * generated function. Furthermore, if an entry_hook is given, V8 will 6316 * generated function. Furthermore, if an entry_hook is given, V8 will
6318 * not use a snapshot, including custom snapshots. 6317 * not use a snapshot, including custom snapshots.
6319 */ 6318 */
6320 FunctionEntryHook entry_hook; 6319 FunctionEntryHook entry_hook;
6321 6320
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6357 */ 6356 */
6358 ArrayBuffer::Allocator* array_buffer_allocator; 6357 ArrayBuffer::Allocator* array_buffer_allocator;
6359 6358
6360 /** 6359 /**
6361 * Specifies an optional nullptr-terminated array of raw addresses in the 6360 * Specifies an optional nullptr-terminated array of raw addresses in the
6362 * embedder that V8 can match against during serialization and use for 6361 * embedder that V8 can match against during serialization and use for
6363 * deserialization. This array and its content must stay valid for the 6362 * deserialization. This array and its content must stay valid for the
6364 * entire lifetime of the isolate. 6363 * entire lifetime of the isolate.
6365 */ 6364 */
6366 intptr_t* external_references; 6365 intptr_t* external_references;
6367
6368 /**
6369 * Specifies an optional callback to deserialize internal fields. It
6370 * should match the SerializeInternalFieldCallback used to serialize.
6371 */
6372 DeserializeInternalFieldsCallback deserialize_internal_fields_callback;
6373 }; 6366 };
6374 6367
6375 6368
6376 /** 6369 /**
6377 * Stack-allocated class which sets the isolate for all operations 6370 * Stack-allocated class which sets the isolate for all operations
6378 * executed within a local scope. 6371 * executed within a local scope.
6379 */ 6372 */
6380 class V8_EXPORT Scope { 6373 class V8_EXPORT Scope {
6381 public: 6374 public:
6382 explicit Scope(Isolate* isolate) : isolate_(isolate) { 6375 explicit Scope(Isolate* isolate) : isolate_(isolate) {
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
7669 * Set the default context to be included in the snapshot blob. 7662 * Set the default context to be included in the snapshot blob.
7670 * The snapshot will not contain the global proxy, and we expect one or a 7663 * The snapshot will not contain the global proxy, and we expect one or a
7671 * global object template to create one, to be provided upon deserialization. 7664 * global object template to create one, to be provided upon deserialization.
7672 */ 7665 */
7673 void SetDefaultContext(Local<Context> context); 7666 void SetDefaultContext(Local<Context> context);
7674 7667
7675 /** 7668 /**
7676 * Add additional context to be included in the snapshot blob. 7669 * Add additional context to be included in the snapshot blob.
7677 * The snapshot will include the global proxy. 7670 * The snapshot will include the global proxy.
7678 * 7671 *
7672 * \param callback optional callback to serialize internal fields.
7673 *
7679 * \returns the index of the context in the snapshot blob. 7674 * \returns the index of the context in the snapshot blob.
7680 */ 7675 */
7681 size_t AddContext(Local<Context> context); 7676 size_t AddContext(Local<Context> context,
7677 SerializeInternalFieldsCallback callback = nullptr);
7682 7678
7683 /** 7679 /**
7684 * Add a template to be included in the snapshot blob. 7680 * Add a template to be included in the snapshot blob.
7685 * \returns the index of the template in the snapshot blob. 7681 * \returns the index of the template in the snapshot blob.
7686 */ 7682 */
7687 size_t AddTemplate(Local<Template> template_obj); 7683 size_t AddTemplate(Local<Template> template_obj);
7688 7684
7689 /** 7685 /**
7690 * Created a snapshot data blob. 7686 * Created a snapshot data blob.
7691 * This must not be called from within a handle scope. 7687 * This must not be called from within a handle scope.
7692 * \param function_code_handling whether to include compiled function code 7688 * \param function_code_handling whether to include compiled function code
7693 * in the snapshot. 7689 * in the snapshot.
7694 * \param callback to serialize embedder-set internal fields.
7695 * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The 7690 * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The
7696 * caller acquires ownership of the data array in the return value. 7691 * caller acquires ownership of the data array in the return value.
7697 */ 7692 */
7698 StartupData CreateBlob(FunctionCodeHandling function_code_handling, 7693 StartupData CreateBlob(FunctionCodeHandling function_code_handling);
7699 SerializeInternalFieldsCallback callback = nullptr);
7700 7694
7701 // Disallow copying and assigning. 7695 // Disallow copying and assigning.
7702 SnapshotCreator(const SnapshotCreator&) = delete; 7696 SnapshotCreator(const SnapshotCreator&) = delete;
7703 void operator=(const SnapshotCreator&) = delete; 7697 void operator=(const SnapshotCreator&) = delete;
7704 7698
7705 private: 7699 private:
7706 void* data_; 7700 void* data_;
7707 }; 7701 };
7708 7702
7709 /** 7703 /**
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
8002 /** 7996 /**
8003 * Create a new context from a (non-default) context snapshot. There 7997 * Create a new context from a (non-default) context snapshot. There
8004 * is no way to provide a global object template since we do not create 7998 * is no way to provide a global object template since we do not create
8005 * a new global object from template, but we can reuse a global object. 7999 * a new global object from template, but we can reuse a global object.
8006 * 8000 *
8007 * \param isolate See v8::Context::New. 8001 * \param isolate See v8::Context::New.
8008 * 8002 *
8009 * \param context_snapshot_index The index of the context snapshot to 8003 * \param context_snapshot_index The index of the context snapshot to
8010 * deserialize from. Use v8::Context::New for the default snapshot. 8004 * deserialize from. Use v8::Context::New for the default snapshot.
8011 * 8005 *
8006 * \param internal_fields_deserializer Optional callback to deserialize
8007 * internal fields. It should match the SerializeInternalFieldCallback used
8008 * to serialize.
8009 *
8012 * \param extensions See v8::Context::New. 8010 * \param extensions See v8::Context::New.
8013 * 8011 *
8014 * \param global_object See v8::Context::New. 8012 * \param global_object See v8::Context::New.
8015 */ 8013 */
8016 8014
8017 static MaybeLocal<Context> FromSnapshot( 8015 static MaybeLocal<Context> FromSnapshot(
8018 Isolate* isolate, size_t context_snapshot_index, 8016 Isolate* isolate, size_t context_snapshot_index,
8017 DeserializeInternalFieldsCallback internal_fields_deserializer = nullptr,
8019 ExtensionConfiguration* extensions = nullptr, 8018 ExtensionConfiguration* extensions = nullptr,
8020 MaybeLocal<Value> global_object = MaybeLocal<Value>()); 8019 MaybeLocal<Value> global_object = MaybeLocal<Value>());
8021 8020
8022 /** 8021 /**
8023 * Returns an global object that isn't backed by an actual context. 8022 * Returns an global object that isn't backed by an actual context.
8024 * 8023 *
8025 * The global template needs to have access checks with handlers installed. 8024 * The global template needs to have access checks with handlers installed.
8026 * If an existing global object is passed in, the global object is detached 8025 * If an existing global object is passed in, the global object is detached
8027 * from its context. 8026 * from its context.
8028 * 8027 *
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
9776 */ 9775 */
9777 9776
9778 9777
9779 } // namespace v8 9778 } // namespace v8
9780 9779
9781 9780
9782 #undef TYPE_CHECK 9781 #undef TYPE_CHECK
9783 9782
9784 9783
9785 #endif // INCLUDE_V8_H_ 9784 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698