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

Side by Side Diff: include/v8.h

Issue 733023003: Reland "Soft fail for invalid cache data." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix leak Created 6 years, 1 month 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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 * the compilation functions in ScriptCompiler contains produce_data_to_cache 1038 * the compilation functions in ScriptCompiler contains produce_data_to_cache
1039 * = true. The data to cache can then can be retrieved from 1039 * = true. The data to cache can then can be retrieved from
1040 * UnboundScript. 1040 * UnboundScript.
1041 */ 1041 */
1042 struct V8_EXPORT CachedData { 1042 struct V8_EXPORT CachedData {
1043 enum BufferPolicy { 1043 enum BufferPolicy {
1044 BufferNotOwned, 1044 BufferNotOwned,
1045 BufferOwned 1045 BufferOwned
1046 }; 1046 };
1047 1047
1048 CachedData() : data(NULL), length(0), buffer_policy(BufferNotOwned) {} 1048 CachedData()
1049 : data(NULL),
1050 length(0),
1051 rejected(false),
1052 buffer_policy(BufferNotOwned) {}
1049 1053
1050 // If buffer_policy is BufferNotOwned, the caller keeps the ownership of 1054 // If buffer_policy is BufferNotOwned, the caller keeps the ownership of
1051 // data and guarantees that it stays alive until the CachedData object is 1055 // data and guarantees that it stays alive until the CachedData object is
1052 // destroyed. If the policy is BufferOwned, the given data will be deleted 1056 // destroyed. If the policy is BufferOwned, the given data will be deleted
1053 // (with delete[]) when the CachedData object is destroyed. 1057 // (with delete[]) when the CachedData object is destroyed.
1054 CachedData(const uint8_t* data, int length, 1058 CachedData(const uint8_t* data, int length,
1055 BufferPolicy buffer_policy = BufferNotOwned); 1059 BufferPolicy buffer_policy = BufferNotOwned);
1056 ~CachedData(); 1060 ~CachedData();
1057 // TODO(marja): Async compilation; add constructors which take a callback 1061 // TODO(marja): Async compilation; add constructors which take a callback
1058 // which will be called when V8 no longer needs the data. 1062 // which will be called when V8 no longer needs the data.
1059 const uint8_t* data; 1063 const uint8_t* data;
1060 int length; 1064 int length;
1065 bool rejected;
1061 BufferPolicy buffer_policy; 1066 BufferPolicy buffer_policy;
1062 1067
1063 private: 1068 private:
1064 // Prevent copying. Not implemented. 1069 // Prevent copying. Not implemented.
1065 CachedData(const CachedData&); 1070 CachedData(const CachedData&);
1066 CachedData& operator=(const CachedData&); 1071 CachedData& operator=(const CachedData&);
1067 }; 1072 };
1068 1073
1069 /** 1074 /**
1070 * Source code which can be then compiled to a UnboundScript or Script. 1075 * Source code which can be then compiled to a UnboundScript or Script.
(...skipping 6356 matching lines...) Expand 10 before | Expand all | Expand 10 after
7427 */ 7432 */
7428 7433
7429 7434
7430 } // namespace v8 7435 } // namespace v8
7431 7436
7432 7437
7433 #undef TYPE_CHECK 7438 #undef TYPE_CHECK
7434 7439
7435 7440
7436 #endif // V8_H_ 7441 #endif // 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