| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2710 | 2710 |
| 2711 class RetainedObjectInfo; | 2711 class RetainedObjectInfo; |
| 2712 | 2712 |
| 2713 /** | 2713 /** |
| 2714 * Isolate represents an isolated instance of the V8 engine. V8 | 2714 * Isolate represents an isolated instance of the V8 engine. V8 |
| 2715 * isolates have completely separate states. Objects from one isolate | 2715 * isolates have completely separate states. Objects from one isolate |
| 2716 * must not be used in other isolates. When V8 is initialized a | 2716 * must not be used in other isolates. When V8 is initialized a |
| 2717 * default isolate is implicitly created and entered. The embedder | 2717 * default isolate is implicitly created and entered. The embedder |
| 2718 * can create additional isolates and use them in parallel in multiple | 2718 * can create additional isolates and use them in parallel in multiple |
| 2719 * threads. An isolate can be entered by at most one thread at any | 2719 * threads. An isolate can be entered by at most one thread at any |
| 2720 * given time. The Locker/Unlocker API can be used to synchronize. | 2720 * given time. The Locker/Unlocker API must be used to synchronize. |
| 2721 */ | 2721 */ |
| 2722 class V8EXPORT Isolate { | 2722 class V8EXPORT Isolate { |
| 2723 public: | 2723 public: |
| 2724 /** | 2724 /** |
| 2725 * Stack-allocated class which sets the isolate for all operations | 2725 * Stack-allocated class which sets the isolate for all operations |
| 2726 * executed within a local scope. | 2726 * executed within a local scope. |
| 2727 */ | 2727 */ |
| 2728 class V8EXPORT Scope { | 2728 class V8EXPORT Scope { |
| 2729 public: | 2729 public: |
| 2730 explicit Scope(Isolate* isolate) : isolate_(isolate) { | 2730 explicit Scope(Isolate* isolate) : isolate_(isolate) { |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3552 }; | 3552 }; |
| 3553 | 3553 |
| 3554 | 3554 |
| 3555 /** | 3555 /** |
| 3556 * Multiple threads in V8 are allowed, but only one thread at a time | 3556 * Multiple threads in V8 are allowed, but only one thread at a time |
| 3557 * is allowed to use any given V8 isolate. See Isolate class | 3557 * is allowed to use any given V8 isolate. See Isolate class |
| 3558 * comments. The definition of 'using V8 isolate' includes | 3558 * comments. The definition of 'using V8 isolate' includes |
| 3559 * accessing handles or holding onto object pointers obtained | 3559 * accessing handles or holding onto object pointers obtained |
| 3560 * from V8 handles while in the particular V8 isolate. It is up | 3560 * from V8 handles while in the particular V8 isolate. It is up |
| 3561 * to the user of V8 to ensure (perhaps with locking) that this | 3561 * to the user of V8 to ensure (perhaps with locking) that this |
| 3562 * constraint is not violated. | 3562 * constraint is not violated. In addition to any other synchronization |
| 3563 * mechanism that may be used, the v8::Locker and v8::Unlocker classes |
| 3564 * must be used to signal thead switches to V8. |
| 3563 * | 3565 * |
| 3564 * v8::Locker is a scoped lock object. While it's | 3566 * v8::Locker is a scoped lock object. While it's |
| 3565 * active (i.e. between its construction and destruction) the current thread is | 3567 * active (i.e. between its construction and destruction) the current thread is |
| 3566 * allowed to use the locked isolate. V8 guarantees that an isolate can be | 3568 * allowed to use the locked isolate. V8 guarantees that an isolate can be |
| 3567 * locked by at most one thread at any time. In other words, the scope of a | 3569 * locked by at most one thread at any time. In other words, the scope of a |
| 3568 * v8::Locker is a critical section. | 3570 * v8::Locker is a critical section. |
| 3569 * | 3571 * |
| 3570 * Sample usage: | 3572 * Sample usage: |
| 3571 * \code | 3573 * \code |
| 3572 * ... | 3574 * ... |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4266 | 4268 |
| 4267 | 4269 |
| 4268 } // namespace v8 | 4270 } // namespace v8 |
| 4269 | 4271 |
| 4270 | 4272 |
| 4271 #undef V8EXPORT | 4273 #undef V8EXPORT |
| 4272 #undef TYPE_CHECK | 4274 #undef TYPE_CHECK |
| 4273 | 4275 |
| 4274 | 4276 |
| 4275 #endif // V8_H_ | 4277 #endif // V8_H_ |
| OLD | NEW |