| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 BlinkGCInterruptor_h | 5 #ifndef BlinkGCInterruptor_h |
| 6 #define BlinkGCInterruptor_h | 6 #define BlinkGCInterruptor_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/Allocator.h" |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 // If attached thread enters long running loop that can call back | 13 // If attached thread enters long running loop that can call back |
| 13 // into Blink and leaving and reentering safepoint at every | 14 // into Blink and leaving and reentering safepoint at every |
| 14 // transition between this loop and Blink is deemed too expensive | 15 // transition between this loop and Blink is deemed too expensive |
| 15 // then instead of marking this loop as a GC safepoint thread | 16 // then instead of marking this loop as a GC safepoint thread |
| 16 // can provide an interruptor object which would allow GC | 17 // can provide an interruptor object which would allow GC |
| 17 // to temporarily interrupt and pause this long running loop at | 18 // to temporarily interrupt and pause this long running loop at |
| 18 // an arbitrary moment creating a safepoint for a GC. | 19 // an arbitrary moment creating a safepoint for a GC. |
| 19 class PLATFORM_EXPORT BlinkGCInterruptor { | 20 class PLATFORM_EXPORT BlinkGCInterruptor { |
| 21 USING_FAST_MALLOC(BlinkGCInterruptor); |
| 20 public: | 22 public: |
| 21 virtual ~BlinkGCInterruptor() { } | 23 virtual ~BlinkGCInterruptor() { } |
| 22 | 24 |
| 23 // Request the interruptor to interrupt the thread and | 25 // Request the interruptor to interrupt the thread and |
| 24 // call onInterrupted on that thread once interruption | 26 // call onInterrupted on that thread once interruption |
| 25 // succeeds. | 27 // succeeds. |
| 26 virtual void requestInterrupt() = 0; | 28 virtual void requestInterrupt() = 0; |
| 27 | 29 |
| 28 protected: | 30 protected: |
| 29 // This method is called on the interrupted thread to | 31 // This method is called on the interrupted thread to |
| 30 // create a safepoint for a GC. | 32 // create a safepoint for a GC. |
| 31 void onInterrupted(); | 33 void onInterrupted(); |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 } // namespace blink | 36 } // namespace blink |
| 35 | 37 |
| 36 #endif | 38 #endif |
| OLD | NEW |