Chromium Code Reviews| 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 7542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7553 StartupData* existing_blob = nullptr); | 7553 StartupData* existing_blob = nullptr); |
| 7554 | 7554 |
| 7555 ~SnapshotCreator(); | 7555 ~SnapshotCreator(); |
| 7556 | 7556 |
| 7557 /** | 7557 /** |
| 7558 * \returns the isolate prepared by the snapshot creator. | 7558 * \returns the isolate prepared by the snapshot creator. |
| 7559 */ | 7559 */ |
| 7560 Isolate* GetIsolate(); | 7560 Isolate* GetIsolate(); |
| 7561 | 7561 |
| 7562 /** | 7562 /** |
| 7563 * Add a context to be included in the snapshot blob. | 7563 * Set the default context to be included in the snapshot blob. |
| 7564 * The snapshot will not contain the global proxy, and we expect one or a | |
| 7565 * global object template to create one, to be provided upon deserialization. | |
| 7566 */ | |
| 7567 void SetDefaultContext(Local<Context> context); | |
| 7568 | |
| 7569 /** | |
| 7570 * Add additional context to be included in the snapshot blob. | |
| 7571 * The snapshot will include the global proxy. | |
| 7572 * | |
| 7564 * \returns the index of the context in the snapshot blob. | 7573 * \returns the index of the context in the snapshot blob. |
| 7565 */ | 7574 */ |
| 7566 size_t AddContext(Local<Context> context); | 7575 size_t AddContext(Local<Context> context); |
| 7567 | 7576 |
| 7568 /** | 7577 /** |
| 7569 * Add a template to be included in the snapshot blob. | 7578 * Add a template to be included in the snapshot blob. |
| 7570 * \returns the index of the template in the snapshot blob. | 7579 * \returns the index of the template in the snapshot blob. |
| 7571 */ | 7580 */ |
| 7572 size_t AddTemplate(Local<Template> template_obj); | 7581 size_t AddTemplate(Local<Template> template_obj); |
| 7573 | 7582 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7877 * the newly created context. This global object must have been | 7886 * the newly created context. This global object must have been |
| 7878 * created by a previous call to Context::New with the same global | 7887 * created by a previous call to Context::New with the same global |
| 7879 * template. The state of the global object will be completely reset | 7888 * template. The state of the global object will be completely reset |
| 7880 * and only object identify will remain. | 7889 * and only object identify will remain. |
| 7881 */ | 7890 */ |
| 7882 static Local<Context> New( | 7891 static Local<Context> New( |
| 7883 Isolate* isolate, ExtensionConfiguration* extensions = NULL, | 7892 Isolate* isolate, ExtensionConfiguration* extensions = NULL, |
| 7884 MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(), | 7893 MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(), |
| 7885 MaybeLocal<Value> global_object = MaybeLocal<Value>()); | 7894 MaybeLocal<Value> global_object = MaybeLocal<Value>()); |
| 7886 | 7895 |
| 7887 static MaybeLocal<Context> FromSnapshot( | |
| 7888 Isolate* isolate, size_t context_snapshot_index, | |
| 7889 ExtensionConfiguration* extensions = nullptr, | |
| 7890 MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(), | |
| 7891 MaybeLocal<Value> global_object = MaybeLocal<Value>()); | |
| 7892 | |
| 7893 /** | 7896 /** |
| 7897 * Create a new context from a (non-default) context snapshot. There | |
| 7898 * is no way to provide a global template or global proxy since the | |
| 7899 * context snapshot already contains a global proxy. | |
| 7900 * | |
| 7901 * \param isolate See v8::Context::New. | |
| 7902 * | |
| 7903 * \param context_snapshot_index The index of the context snapshot to | |
| 7904 * deserialize from. It must be larger than 0. Use v8::Context::New for the | |
|
peria
2016/12/07 10:11:08
According to tests, we can use 0 for this index, r
Yang
2016/12/07 10:13:34
Nice catch. The comment is outdated. Fixed.
| |
| 7905 * default (0-th) snapshot. | |
| 7906 * | |
| 7907 * \param extensions See v8::Context::New. | |
| 7908 */ | |
| 7909 | |
| 7910 static MaybeLocal<Context> FromSnapshot( | |
| 7911 Isolate* isolate, size_t context_snapshot_index, | |
| 7912 ExtensionConfiguration* extensions = nullptr); | |
| 7913 | |
| 7914 /** | |
| 7894 * Returns an global object that isn't backed by an actual context. | 7915 * Returns an global object that isn't backed by an actual context. |
| 7895 * | 7916 * |
| 7896 * The global template needs to have access checks with handlers installed. | 7917 * The global template needs to have access checks with handlers installed. |
| 7897 * If an existing global object is passed in, the global object is detached | 7918 * If an existing global object is passed in, the global object is detached |
| 7898 * from its context. | 7919 * from its context. |
| 7899 * | 7920 * |
| 7900 * Note that this is different from a detached context where all accesses to | 7921 * Note that this is different from a detached context where all accesses to |
| 7901 * the global proxy will fail. Instead, the access check handlers are invoked. | 7922 * the global proxy will fail. Instead, the access check handlers are invoked. |
| 7902 * | 7923 * |
| 7903 * It is also not possible to detach an object returned by this method. | 7924 * It is also not possible to detach an object returned by this method. |
| (...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9647 */ | 9668 */ |
| 9648 | 9669 |
| 9649 | 9670 |
| 9650 } // namespace v8 | 9671 } // namespace v8 |
| 9651 | 9672 |
| 9652 | 9673 |
| 9653 #undef TYPE_CHECK | 9674 #undef TYPE_CHECK |
| 9654 | 9675 |
| 9655 | 9676 |
| 9656 #endif // INCLUDE_V8_H_ | 9677 #endif // INCLUDE_V8_H_ |
| OLD | NEW |