OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_UTIL_H_ | 5 #ifndef V8_UTIL_H_ |
6 #define V8_UTIL_H_ | 6 #define V8_UTIL_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void Append(Local<V> value) { | 415 void Append(Local<V> value) { |
416 UniquePersistent<V> persistent(isolate_, value); | 416 UniquePersistent<V> persistent(isolate_, value); |
417 Traits::Append(&impl_, ClearAndLeak(&persistent)); | 417 Traits::Append(&impl_, ClearAndLeak(&persistent)); |
418 } | 418 } |
419 | 419 |
420 /** | 420 /** |
421 * Append a persistent's value to the vector. | 421 * Append a persistent's value to the vector. |
422 */ | 422 */ |
423 void Append(UniquePersistent<V> persistent) { | 423 void Append(UniquePersistent<V> persistent) { |
424 Traits::Append(&impl_, ClearAndLeak(&persistent)); | 424 Traits::Append(&impl_, ClearAndLeak(&persistent)); |
425 }; | 425 } |
426 | 426 |
427 /** | 427 /** |
428 * Are there any values in the vector? | 428 * Are there any values in the vector? |
429 */ | 429 */ |
430 bool IsEmpty() const { | 430 bool IsEmpty() const { |
431 return Traits::IsEmpty(&impl_); | 431 return Traits::IsEmpty(&impl_); |
432 } | 432 } |
433 | 433 |
434 /** | 434 /** |
435 * How many elements are in the vector? | 435 * How many elements are in the vector? |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 return reinterpret_cast<V*>(v); | 477 return reinterpret_cast<V*>(v); |
478 } | 478 } |
479 | 479 |
480 Isolate* isolate_; | 480 Isolate* isolate_; |
481 typename Traits::Impl impl_; | 481 typename Traits::Impl impl_; |
482 }; | 482 }; |
483 | 483 |
484 } // namespace v8 | 484 } // namespace v8 |
485 | 485 |
486 #endif // V8_UTIL_H_ | 486 #endif // V8_UTIL_H_ |
OLD | NEW |