OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 * place in the new handle scope until it is deleted. After that, | 507 * place in the new handle scope until it is deleted. After that, |
508 * new handles will again be allocated in the original handle scope. | 508 * new handles will again be allocated in the original handle scope. |
509 * | 509 * |
510 * After the handle scope of a local handle has been deleted the | 510 * After the handle scope of a local handle has been deleted the |
511 * garbage collector will no longer track the object stored in the | 511 * garbage collector will no longer track the object stored in the |
512 * handle and may deallocate it. The behavior of accessing a handle | 512 * handle and may deallocate it. The behavior of accessing a handle |
513 * for which the handle scope has been deleted is undefined. | 513 * for which the handle scope has been deleted is undefined. |
514 */ | 514 */ |
515 class V8EXPORT HandleScope { | 515 class V8EXPORT HandleScope { |
516 public: | 516 public: |
| 517 // TODO(svenpanne) Deprecate me when Chrome is fixed! |
517 HandleScope(); | 518 HandleScope(); |
518 | 519 |
| 520 HandleScope(Isolate* isolate); |
| 521 |
519 ~HandleScope(); | 522 ~HandleScope(); |
520 | 523 |
521 /** | 524 /** |
522 * Closes the handle scope and returns the value as a handle in the | 525 * Closes the handle scope and returns the value as a handle in the |
523 * previous scope, which is the new current scope after the call. | 526 * previous scope, which is the new current scope after the call. |
524 */ | 527 */ |
525 template <class T> Local<T> Close(Handle<T> value); | 528 template <class T> Local<T> Close(Handle<T> value); |
526 | 529 |
527 /** | 530 /** |
528 * Counts the number of allocated handles. | 531 * Counts the number of allocated handles. |
(...skipping 23 matching lines...) Expand all Loading... |
552 public: | 555 public: |
553 internal::Object** next; | 556 internal::Object** next; |
554 internal::Object** limit; | 557 internal::Object** limit; |
555 int level; | 558 int level; |
556 V8_INLINE(void Initialize()) { | 559 V8_INLINE(void Initialize()) { |
557 next = limit = NULL; | 560 next = limit = NULL; |
558 level = 0; | 561 level = 0; |
559 } | 562 } |
560 }; | 563 }; |
561 | 564 |
| 565 void Initialize(Isolate* isolate); |
562 void Leave(); | 566 void Leave(); |
563 | 567 |
564 internal::Isolate* isolate_; | 568 internal::Isolate* isolate_; |
565 internal::Object** prev_next_; | 569 internal::Object** prev_next_; |
566 internal::Object** prev_limit_; | 570 internal::Object** prev_limit_; |
567 | 571 |
568 // Allow for the active closing of HandleScopes which allows to pass a handle | 572 // Allow for the active closing of HandleScopes which allows to pass a handle |
569 // from the HandleScope being closed to the next top most HandleScope. | 573 // from the HandleScope being closed to the next top most HandleScope. |
570 bool is_closed_; | 574 bool is_closed_; |
571 internal::Object** RawClose(internal::Object** value); | 575 internal::Object** RawClose(internal::Object** value); |
(...skipping 4449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5021 | 5025 |
5022 | 5026 |
5023 } // namespace v8 | 5027 } // namespace v8 |
5024 | 5028 |
5025 | 5029 |
5026 #undef V8EXPORT | 5030 #undef V8EXPORT |
5027 #undef TYPE_CHECK | 5031 #undef TYPE_CHECK |
5028 | 5032 |
5029 | 5033 |
5030 #endif // V8_H_ | 5034 #endif // V8_H_ |
OLD | NEW |