| OLD | NEW |
| 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 6263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6274 /** | 6274 /** |
| 6275 * Returns the number of wrappers that are still to be traced by the embedder. | 6275 * Returns the number of wrappers that are still to be traced by the embedder. |
| 6276 */ | 6276 */ |
| 6277 virtual size_t NumberOfWrappersToTrace() { return 0; } | 6277 virtual size_t NumberOfWrappersToTrace() { return 0; } |
| 6278 | 6278 |
| 6279 protected: | 6279 protected: |
| 6280 virtual ~EmbedderHeapTracer() = default; | 6280 virtual ~EmbedderHeapTracer() = default; |
| 6281 }; | 6281 }; |
| 6282 | 6282 |
| 6283 /** | 6283 /** |
| 6284 * Callback to the embedder used in SnapshotCreator to handle internal fields. | 6284 * Callback and supporting data used in SnapshotCreator to implement embedder |
| 6285 * logic to serialize internal fields. |
| 6285 */ | 6286 */ |
| 6286 typedef StartupData (*SerializeInternalFieldsCallback)(Local<Object> holder, | 6287 struct SerializeInternalFieldsCallback { |
| 6287 int index); | 6288 typedef StartupData (*CallbackFunction)(Local<Object> holder, int index, |
| 6289 void* data); |
| 6290 SerializeInternalFieldsCallback(CallbackFunction function = nullptr, |
| 6291 void* data_arg = nullptr) |
| 6292 : callback(function), data(data_arg) {} |
| 6293 CallbackFunction callback; |
| 6294 void* data; |
| 6295 }; |
| 6288 | 6296 |
| 6289 /** | 6297 /** |
| 6290 * Callback to the embedder used to deserialize internal fields. | 6298 * Callback and supporting data used to implement embedder logic to deserialize |
| 6299 * internal fields. |
| 6291 */ | 6300 */ |
| 6292 typedef void (*DeserializeInternalFieldsCallback)(Local<Object> holder, | 6301 struct DeserializeInternalFieldsCallback { |
| 6293 int index, | 6302 typedef void (*CallbackFunction)(Local<Object> holder, int index, |
| 6294 StartupData payload); | 6303 StartupData payload, void* data); |
| 6304 DeserializeInternalFieldsCallback(CallbackFunction function = nullptr, |
| 6305 void* data_arg = nullptr) |
| 6306 : callback(function), data(data_arg) {} |
| 6307 void (*callback)(Local<Object> holder, int index, StartupData payload, |
| 6308 void* data); |
| 6309 void* data; |
| 6310 }; |
| 6295 | 6311 |
| 6296 /** | 6312 /** |
| 6297 * Isolate represents an isolated instance of the V8 engine. V8 isolates have | 6313 * Isolate represents an isolated instance of the V8 engine. V8 isolates have |
| 6298 * completely separate states. Objects from one isolate must not be used in | 6314 * completely separate states. Objects from one isolate must not be used in |
| 6299 * other isolates. The embedder can create multiple isolates and use them in | 6315 * other isolates. The embedder can create multiple isolates and use them in |
| 6300 * parallel in multiple threads. An isolate can be entered by at most one | 6316 * parallel in multiple threads. An isolate can be entered by at most one |
| 6301 * thread at any given time. The Locker/Unlocker API must be used to | 6317 * thread at any given time. The Locker/Unlocker API must be used to |
| 6302 * synchronize. | 6318 * synchronize. |
| 6303 */ | 6319 */ |
| 6304 class V8_EXPORT Isolate { | 6320 class V8_EXPORT Isolate { |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7681 | 7697 |
| 7682 /** | 7698 /** |
| 7683 * Add additional context to be included in the snapshot blob. | 7699 * Add additional context to be included in the snapshot blob. |
| 7684 * The snapshot will include the global proxy. | 7700 * The snapshot will include the global proxy. |
| 7685 * | 7701 * |
| 7686 * \param callback optional callback to serialize internal fields. | 7702 * \param callback optional callback to serialize internal fields. |
| 7687 * | 7703 * |
| 7688 * \returns the index of the context in the snapshot blob. | 7704 * \returns the index of the context in the snapshot blob. |
| 7689 */ | 7705 */ |
| 7690 size_t AddContext(Local<Context> context, | 7706 size_t AddContext(Local<Context> context, |
| 7691 SerializeInternalFieldsCallback callback = nullptr); | 7707 SerializeInternalFieldsCallback callback = |
| 7708 SerializeInternalFieldsCallback()); |
| 7692 | 7709 |
| 7693 /** | 7710 /** |
| 7694 * Add a template to be included in the snapshot blob. | 7711 * Add a template to be included in the snapshot blob. |
| 7695 * \returns the index of the template in the snapshot blob. | 7712 * \returns the index of the template in the snapshot blob. |
| 7696 */ | 7713 */ |
| 7697 size_t AddTemplate(Local<Template> template_obj); | 7714 size_t AddTemplate(Local<Template> template_obj); |
| 7698 | 7715 |
| 7699 /** | 7716 /** |
| 7700 * Created a snapshot data blob. | 7717 * Created a snapshot data blob. |
| 7701 * This must not be called from within a handle scope. | 7718 * This must not be called from within a handle scope. |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8021 * internal fields. It should match the SerializeInternalFieldCallback used | 8038 * internal fields. It should match the SerializeInternalFieldCallback used |
| 8022 * to serialize. | 8039 * to serialize. |
| 8023 * | 8040 * |
| 8024 * \param extensions See v8::Context::New. | 8041 * \param extensions See v8::Context::New. |
| 8025 * | 8042 * |
| 8026 * \param global_object See v8::Context::New. | 8043 * \param global_object See v8::Context::New. |
| 8027 */ | 8044 */ |
| 8028 | 8045 |
| 8029 static MaybeLocal<Context> FromSnapshot( | 8046 static MaybeLocal<Context> FromSnapshot( |
| 8030 Isolate* isolate, size_t context_snapshot_index, | 8047 Isolate* isolate, size_t context_snapshot_index, |
| 8031 DeserializeInternalFieldsCallback internal_fields_deserializer = nullptr, | 8048 DeserializeInternalFieldsCallback internal_fields_deserializer = |
| 8049 DeserializeInternalFieldsCallback(), |
| 8032 ExtensionConfiguration* extensions = nullptr, | 8050 ExtensionConfiguration* extensions = nullptr, |
| 8033 MaybeLocal<Value> global_object = MaybeLocal<Value>()); | 8051 MaybeLocal<Value> global_object = MaybeLocal<Value>()); |
| 8034 | 8052 |
| 8035 /** | 8053 /** |
| 8036 * Returns an global object that isn't backed by an actual context. | 8054 * Returns an global object that isn't backed by an actual context. |
| 8037 * | 8055 * |
| 8038 * The global template needs to have access checks with handlers installed. | 8056 * The global template needs to have access checks with handlers installed. |
| 8039 * If an existing global object is passed in, the global object is detached | 8057 * If an existing global object is passed in, the global object is detached |
| 8040 * from its context. | 8058 * from its context. |
| 8041 * | 8059 * |
| (...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9806 */ | 9824 */ |
| 9807 | 9825 |
| 9808 | 9826 |
| 9809 } // namespace v8 | 9827 } // namespace v8 |
| 9810 | 9828 |
| 9811 | 9829 |
| 9812 #undef TYPE_CHECK | 9830 #undef TYPE_CHECK |
| 9813 | 9831 |
| 9814 | 9832 |
| 9815 #endif // INCLUDE_V8_H_ | 9833 #endif // INCLUDE_V8_H_ |
| OLD | NEW |