Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 * Handle<Number>. | 205 * Handle<Number>. |
| 206 */ | 206 */ |
| 207 TYPE_CHECK(T, S); | 207 TYPE_CHECK(T, S); |
| 208 } | 208 } |
| 209 | 209 |
| 210 /** | 210 /** |
| 211 * Returns true if the handle is empty. | 211 * Returns true if the handle is empty. |
| 212 */ | 212 */ |
| 213 bool IsEmpty() const { return val_ == 0; } | 213 bool IsEmpty() const { return val_ == 0; } |
| 214 | 214 |
| 215 T* operator->() const; | 215 T* operator->() const { |
|
Kasper Lund
2009/06/11 14:51:30
I would write this on a single line just like the
antonm
2009/06/11 19:40:47
Done.
| |
| 216 return val_; | |
| 217 } | |
| 216 | 218 |
| 217 T* operator*() const; | 219 T* operator*() const { |
|
Kasper Lund
2009/06/11 14:51:30
Ditto.
antonm
2009/06/11 19:40:47
Done.
| |
| 220 return val_; | |
| 221 } | |
| 218 | 222 |
| 219 /** | 223 /** |
| 220 * Sets the handle to be empty. IsEmpty() will then return true. | 224 * Sets the handle to be empty. IsEmpty() will then return true. |
| 221 */ | 225 */ |
| 222 void Clear() { this->val_ = 0; } | 226 void Clear() { this->val_ = 0; } |
| 223 | 227 |
| 224 /** | 228 /** |
| 225 * Checks whether two handles are the same. | 229 * Checks whether two handles are the same. |
| 226 * Returns true if both are empty, or if the objects | 230 * Returns true if both are empty, or if the objects |
| 227 * to which they refer are identical. | 231 * to which they refer are identical. |
| (...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2502 template <class T> | 2506 template <class T> |
| 2503 void Persistent<T>::MakeWeak(void* parameters, WeakReferenceCallback callback) { | 2507 void Persistent<T>::MakeWeak(void* parameters, WeakReferenceCallback callback) { |
| 2504 V8::MakeWeak(reinterpret_cast<void**>(**this), parameters, callback); | 2508 V8::MakeWeak(reinterpret_cast<void**>(**this), parameters, callback); |
| 2505 } | 2509 } |
| 2506 | 2510 |
| 2507 template <class T> | 2511 template <class T> |
| 2508 void Persistent<T>::ClearWeak() { | 2512 void Persistent<T>::ClearWeak() { |
| 2509 V8::ClearWeak(reinterpret_cast<void**>(**this)); | 2513 V8::ClearWeak(reinterpret_cast<void**>(**this)); |
| 2510 } | 2514 } |
| 2511 | 2515 |
| 2512 template <class T> | |
| 2513 T* Handle<T>::operator->() const { | |
| 2514 return val_; | |
| 2515 } | |
| 2516 | |
| 2517 | |
| 2518 template <class T> | |
| 2519 T* Handle<T>::operator*() const { | |
| 2520 return val_; | |
| 2521 } | |
| 2522 | |
| 2523 | |
| 2524 Local<Value> Arguments::operator[](int i) const { | 2516 Local<Value> Arguments::operator[](int i) const { |
| 2525 if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); | 2517 if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); |
| 2526 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); | 2518 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); |
| 2527 } | 2519 } |
| 2528 | 2520 |
| 2529 | 2521 |
| 2530 Local<Function> Arguments::Callee() const { | 2522 Local<Function> Arguments::Callee() const { |
| 2531 return callee_; | 2523 return callee_; |
| 2532 } | 2524 } |
| 2533 | 2525 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2617 | 2609 |
| 2618 } // namespace v8 | 2610 } // namespace v8 |
| 2619 | 2611 |
| 2620 | 2612 |
| 2621 #undef V8EXPORT | 2613 #undef V8EXPORT |
| 2622 #undef V8EXPORT_INLINE | 2614 #undef V8EXPORT_INLINE |
| 2623 #undef TYPE_CHECK | 2615 #undef TYPE_CHECK |
| 2624 | 2616 |
| 2625 | 2617 |
| 2626 #endif // V8_H_ | 2618 #endif // V8_H_ |
| OLD | NEW |