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

Side by Side Diff: include/v8.h

Issue 2046423002: [snapshot] introduce SnapshotCreator API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 6 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 6751 matching lines...) Expand 10 before | Expand all | Expand 10 after
6762 template <class T> 6762 template <class T>
6763 friend class Maybe; 6763 friend class Maybe;
6764 template <class T> 6764 template <class T>
6765 friend class WeakCallbackInfo; 6765 friend class WeakCallbackInfo;
6766 template <class T> friend class Eternal; 6766 template <class T> friend class Eternal;
6767 template <class T> friend class PersistentBase; 6767 template <class T> friend class PersistentBase;
6768 template <class T, class M> friend class Persistent; 6768 template <class T, class M> friend class Persistent;
6769 friend class Context; 6769 friend class Context;
6770 }; 6770 };
6771 6771
6772 /**
6773 * Helper class to create a snapshot data blob.
6774 */
6775 class SnapshotCreator {
6776 public:
6777 enum class FunctionCodeHandling { kClear, kKeep };
6778
6779 /**
6780 * Create and enter an isolate, and set it up for serialization.
6781 * The isolate is either created from scratch or from an existing snapshot.
6782 * The caller keeps ownership of the argument snapshot.
6783 */
6784 explicit SnapshotCreator(StartupData* existing_blob = nullptr);
6785
6786 ~SnapshotCreator();
6787
6788 /**
6789 * \returns the isolate prepared by the snapshot creator.
6790 */
6791 Isolate* GetIsolate();
6792
6793 /**
6794 * Add a context to be included in the snapshot blob.
6795 */
6796 void AddContext(Local<Context> context);
6797
6798 /**
6799 * Created a snapshot data blob.
6800 * \param function_code_handling whether to include compiled function code
6801 * in the snapshot.
6802 * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The
6803 * caller acquires ownership of the data array in the return value.
6804 */
6805 StartupData CreateBlob(FunctionCodeHandling function_code_handling);
6806
6807 private:
6808 void* data_;
6809
6810 // Disallow copying and assigning.
6811 SnapshotCreator(const SnapshotCreator&);
6812 void operator=(const SnapshotCreator&);
6813 };
6772 6814
6773 /** 6815 /**
6774 * A simple Maybe type, representing an object which may or may not have a 6816 * A simple Maybe type, representing an object which may or may not have a
6775 * value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html. 6817 * value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.
6776 * 6818 *
6777 * If an API method returns a Maybe<>, the API method can potentially fail 6819 * If an API method returns a Maybe<>, the API method can potentially fail
6778 * either because an exception is thrown, or because an exception is pending, 6820 * either because an exception is thrown, or because an exception is pending,
6779 * e.g. because a previous API call threw an exception that hasn't been caught 6821 * e.g. because a previous API call threw an exception that hasn't been caught
6780 * yet, or because a TerminateExecution exception was thrown. In that case, a 6822 * yet, or because a TerminateExecution exception was thrown. In that case, a
6781 * "Nothing" value is returned. 6823 * "Nothing" value is returned.
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
8814 */ 8856 */
8815 8857
8816 8858
8817 } // namespace v8 8859 } // namespace v8
8818 8860
8819 8861
8820 #undef TYPE_CHECK 8862 #undef TYPE_CHECK
8821 8863
8822 8864
8823 #endif // INCLUDE_V8_H_ 8865 #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