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