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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() | 1048 CachedData() : data(NULL), length(0), buffer_policy(BufferNotOwned) {} |
1049 : data(NULL), | |
1050 length(0), | |
1051 rejected(false), | |
1052 buffer_policy(BufferNotOwned) {} | |
1053 | 1049 |
1054 // If buffer_policy is BufferNotOwned, the caller keeps the ownership of | 1050 // If buffer_policy is BufferNotOwned, the caller keeps the ownership of |
1055 // data and guarantees that it stays alive until the CachedData object is | 1051 // data and guarantees that it stays alive until the CachedData object is |
1056 // destroyed. If the policy is BufferOwned, the given data will be deleted | 1052 // destroyed. If the policy is BufferOwned, the given data will be deleted |
1057 // (with delete[]) when the CachedData object is destroyed. | 1053 // (with delete[]) when the CachedData object is destroyed. |
1058 CachedData(const uint8_t* data, int length, | 1054 CachedData(const uint8_t* data, int length, |
1059 BufferPolicy buffer_policy = BufferNotOwned); | 1055 BufferPolicy buffer_policy = BufferNotOwned); |
1060 ~CachedData(); | 1056 ~CachedData(); |
1061 // TODO(marja): Async compilation; add constructors which take a callback | 1057 // TODO(marja): Async compilation; add constructors which take a callback |
1062 // which will be called when V8 no longer needs the data. | 1058 // which will be called when V8 no longer needs the data. |
1063 const uint8_t* data; | 1059 const uint8_t* data; |
1064 int length; | 1060 int length; |
1065 bool rejected; | |
1066 BufferPolicy buffer_policy; | 1061 BufferPolicy buffer_policy; |
1067 | 1062 |
1068 private: | 1063 private: |
1069 // Prevent copying. Not implemented. | 1064 // Prevent copying. Not implemented. |
1070 CachedData(const CachedData&); | 1065 CachedData(const CachedData&); |
1071 CachedData& operator=(const CachedData&); | 1066 CachedData& operator=(const CachedData&); |
1072 }; | 1067 }; |
1073 | 1068 |
1074 /** | 1069 /** |
1075 * Source code which can be then compiled to a UnboundScript or Script. | 1070 * Source code which can be then compiled to a UnboundScript or Script. |
(...skipping 6336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7412 */ | 7407 */ |
7413 | 7408 |
7414 | 7409 |
7415 } // namespace v8 | 7410 } // namespace v8 |
7416 | 7411 |
7417 | 7412 |
7418 #undef TYPE_CHECK | 7413 #undef TYPE_CHECK |
7419 | 7414 |
7420 | 7415 |
7421 #endif // V8_H_ | 7416 #endif // V8_H_ |
OLD | NEW |