1 // Copyright 2018 the V8 project 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 V8_OBJECTS_MICROTASK_H_ 6 #define V8_OBJECTS_MICROTASK_H_ 7 8 #include "src/objects/objects.h" 9 #include "src/objects/struct.h" 10 11 // Has to be the last include (doesn't have include guards): 12 #include "src/objects/object-macros.h" 13 14 namespace v8 { 15 namespace internal { 16 17 #include "torque-generated/src/objects/microtask-tq.inc" 18 19 // Abstract base class for all microtasks that can be scheduled on the 20 // microtask queue. This class merely serves the purpose of a marker 21 // interface. 22 class Microtask : public TorqueGeneratedMicrotask<Microtask, Struct> { 23 public: 24 TQ_OBJECT_CONSTRUCTORS(Microtask) 25 }; 26 27 // A CallbackTask is a special Microtask that allows us to schedule 28 // C++ microtask callbacks on the microtask queue. This is heavily 29 // used by Blink for example. 30 class CallbackTask 31 : public TorqueGeneratedCallbackTask<CallbackTask, Microtask> { 32 public: 33 // Dispatched behavior. 34 DECL_PRINTER(CallbackTask) 35 36 TQ_OBJECT_CONSTRUCTORS(CallbackTask) 37 }; 38 39 // A CallableTask is a special (internal) Microtask that allows us to 40 // schedule arbitrary callables on the microtask queue. We use this 41 // for various tests of the microtask queue. 42 class CallableTask 43 : public TorqueGeneratedCallableTask<CallableTask, Microtask> { 44 public: 45 // Dispatched behavior. 46 DECL_PRINTER(CallableTask) 47 DECL_VERIFIER(CallableTask) 48 void BriefPrintDetails(std::ostream& os); 49 50 TQ_OBJECT_CONSTRUCTORS(CallableTask) 51 }; 52 53 } // namespace internal 54 } // namespace v8 55 56 #include "src/objects/object-macros-undef.h" 57 58 #endif // V8_OBJECTS_MICROTASK_H_ 59