OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 * // V8 Now no longer locked. | 2733 * // V8 Now no longer locked. |
2734 * \endcode | 2734 * \endcode |
2735 */ | 2735 */ |
2736 class V8EXPORT Unlocker { | 2736 class V8EXPORT Unlocker { |
2737 public: | 2737 public: |
2738 Unlocker(); | 2738 Unlocker(); |
2739 ~Unlocker(); | 2739 ~Unlocker(); |
2740 }; | 2740 }; |
2741 | 2741 |
2742 | 2742 |
| 2743 class LockParameters; |
| 2744 |
2743 class V8EXPORT Locker { | 2745 class V8EXPORT Locker { |
2744 public: | 2746 public: |
2745 Locker(); | 2747 Locker(LockParameters* lock_parameters = NULL); |
2746 ~Locker(); | 2748 ~Locker(); |
2747 | 2749 |
2748 /** | 2750 /** |
2749 * Start preemption. | 2751 * Start preemption. |
2750 * | 2752 * |
2751 * When preemption is started, a timer is fired every n milli seconds | 2753 * When preemption is started, a timer is fired every n milli seconds |
2752 * that will switch between multiple threads that are in contention | 2754 * that will switch between multiple threads that are in contention |
2753 * for the V8 lock. | 2755 * for the V8 lock. |
2754 */ | 2756 */ |
2755 static void StartPreemption(int every_n_ms); | 2757 static void StartPreemption(int every_n_ms); |
2756 | 2758 |
2757 /** | 2759 /** |
2758 * Stop preemption. | 2760 * Stop preemption. |
2759 */ | 2761 */ |
2760 static void StopPreemption(); | 2762 static void StopPreemption(); |
2761 | 2763 |
2762 /** | 2764 /** |
2763 * Returns whether or not the locker is locked by the current thread. | 2765 * Returns whether or not the locker is locked by the current thread. |
2764 */ | 2766 */ |
2765 static bool IsLocked(); | 2767 static bool IsLocked(); |
2766 | 2768 |
2767 /** | 2769 /** |
2768 * Returns whether v8::Locker is being used by this V8 instance. | 2770 * Returns whether v8::Locker is being used by this V8 instance. |
2769 */ | 2771 */ |
2770 static bool IsActive() { return active_; } | 2772 static bool IsActive() { return active_; } |
2771 | 2773 |
2772 private: | 2774 private: |
2773 bool has_lock_; | 2775 bool has_lock_; |
2774 bool top_level_; | 2776 bool top_level_; |
| 2777 bool effective_; |
2775 | 2778 |
2776 static bool active_; | 2779 static bool active_; |
2777 | 2780 |
2778 // Disallow copying and assigning. | 2781 // Disallow copying and assigning. |
2779 Locker(const Locker&); | 2782 Locker(const Locker&); |
2780 void operator=(const Locker&); | 2783 void operator=(const Locker&); |
2781 }; | 2784 }; |
2782 | 2785 |
2783 | 2786 |
2784 | 2787 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3226 | 3229 |
3227 } // namespace v8 | 3230 } // namespace v8 |
3228 | 3231 |
3229 | 3232 |
3230 #undef V8EXPORT | 3233 #undef V8EXPORT |
3231 #undef V8EXPORT_INLINE | 3234 #undef V8EXPORT_INLINE |
3232 #undef TYPE_CHECK | 3235 #undef TYPE_CHECK |
3233 | 3236 |
3234 | 3237 |
3235 #endif // V8_H_ | 3238 #endif // V8_H_ |
OLD | NEW |