OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); | 1134 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); |
1135 void SetName(Handle<String> name); | 1135 void SetName(Handle<String> name); |
1136 Handle<Value> GetName() const; | 1136 Handle<Value> GetName() const; |
1137 static Function* Cast(Value* obj); | 1137 static Function* Cast(Value* obj); |
1138 private: | 1138 private: |
1139 Function(); | 1139 Function(); |
1140 }; | 1140 }; |
1141 | 1141 |
1142 | 1142 |
1143 /** | 1143 /** |
1144 * A JavaScript value that wraps a c++ void*. This type of value is | 1144 * A JavaScript value that wraps a C++ void*. This type of value is |
1145 * mainly used to associate c++ data structures with JavaScript | 1145 * mainly used to associate C++ data structures with JavaScript |
1146 * objects. | 1146 * objects. |
| 1147 * |
| 1148 * The Wrap function V8 will return the most optimal Value object wrapping the |
| 1149 * C++ void*. The type of the value is not guaranteed to be an External object |
| 1150 * and no assumptions about its type should be made. To access the wrapped |
| 1151 * value Unwrap should be used, all other operations on that object will lead |
| 1152 * to unpredictable results. |
1147 */ | 1153 */ |
1148 class V8EXPORT External : public Value { | 1154 class V8EXPORT External : public Value { |
1149 public: | 1155 public: |
| 1156 static Local<Value> Wrap(void* data); |
| 1157 static void* Unwrap(Handle<Value> obj); |
| 1158 |
1150 static Local<External> New(void* value); | 1159 static Local<External> New(void* value); |
1151 static External* Cast(Value* obj); | 1160 static External* Cast(Value* obj); |
1152 void* Value() const; | 1161 void* Value() const; |
1153 private: | 1162 private: |
1154 enum { | |
1155 kAlignedPointerMask = 3, | |
1156 kAlignedPointerShift = 2 | |
1157 }; | |
1158 External(); | 1163 External(); |
1159 }; | 1164 }; |
1160 | 1165 |
1161 | 1166 |
1162 // --- T e m p l a t e s --- | 1167 // --- T e m p l a t e s --- |
1163 | 1168 |
1164 | 1169 |
1165 /** | 1170 /** |
1166 * The superclass of object and function templates. | 1171 * The superclass of object and function templates. |
1167 */ | 1172 */ |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 | 2509 |
2505 } // namespace v8 | 2510 } // namespace v8 |
2506 | 2511 |
2507 | 2512 |
2508 #undef V8EXPORT | 2513 #undef V8EXPORT |
2509 #undef V8EXPORT_INLINE | 2514 #undef V8EXPORT_INLINE |
2510 #undef TYPE_CHECK | 2515 #undef TYPE_CHECK |
2511 | 2516 |
2512 | 2517 |
2513 #endif // V8_H_ | 2518 #endif // V8_H_ |
OLD | NEW |