| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 * place in the new handle scope until it is deleted. After that, | 510 * place in the new handle scope until it is deleted. After that, |
| 511 * new handles will again be allocated in the original handle scope. | 511 * new handles will again be allocated in the original handle scope. |
| 512 * | 512 * |
| 513 * After the handle scope of a local handle has been deleted the | 513 * After the handle scope of a local handle has been deleted the |
| 514 * garbage collector will no longer track the object stored in the | 514 * garbage collector will no longer track the object stored in the |
| 515 * handle and may deallocate it. The behavior of accessing a handle | 515 * handle and may deallocate it. The behavior of accessing a handle |
| 516 * for which the handle scope has been deleted is undefined. | 516 * for which the handle scope has been deleted is undefined. |
| 517 */ | 517 */ |
| 518 class V8EXPORT HandleScope { | 518 class V8EXPORT HandleScope { |
| 519 public: | 519 public: |
| 520 // TODO(svenpanne) Deprecate me when Chrome is fixed! |
| 520 HandleScope(); | 521 HandleScope(); |
| 521 | 522 |
| 523 HandleScope(Isolate* isolate); |
| 524 |
| 522 ~HandleScope(); | 525 ~HandleScope(); |
| 523 | 526 |
| 524 /** | 527 /** |
| 525 * Closes the handle scope and returns the value as a handle in the | 528 * Closes the handle scope and returns the value as a handle in the |
| 526 * previous scope, which is the new current scope after the call. | 529 * previous scope, which is the new current scope after the call. |
| 527 */ | 530 */ |
| 528 template <class T> Local<T> Close(Handle<T> value); | 531 template <class T> Local<T> Close(Handle<T> value); |
| 529 | 532 |
| 530 /** | 533 /** |
| 531 * Counts the number of allocated handles. | 534 * Counts the number of allocated handles. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 555 public: | 558 public: |
| 556 internal::Object** next; | 559 internal::Object** next; |
| 557 internal::Object** limit; | 560 internal::Object** limit; |
| 558 int level; | 561 int level; |
| 559 V8_INLINE(void Initialize()) { | 562 V8_INLINE(void Initialize()) { |
| 560 next = limit = NULL; | 563 next = limit = NULL; |
| 561 level = 0; | 564 level = 0; |
| 562 } | 565 } |
| 563 }; | 566 }; |
| 564 | 567 |
| 568 void Initialize(Isolate* isolate); |
| 565 void Leave(); | 569 void Leave(); |
| 566 | 570 |
| 567 internal::Isolate* isolate_; | 571 internal::Isolate* isolate_; |
| 568 internal::Object** prev_next_; | 572 internal::Object** prev_next_; |
| 569 internal::Object** prev_limit_; | 573 internal::Object** prev_limit_; |
| 570 | 574 |
| 571 // Allow for the active closing of HandleScopes which allows to pass a handle | 575 // Allow for the active closing of HandleScopes which allows to pass a handle |
| 572 // from the HandleScope being closed to the next top most HandleScope. | 576 // from the HandleScope being closed to the next top most HandleScope. |
| 573 bool is_closed_; | 577 bool is_closed_; |
| 574 internal::Object** RawClose(internal::Object** value); | 578 internal::Object** RawClose(internal::Object** value); |
| (...skipping 4446 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 |