• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 class StructBodyDescriptor;
18 
19 #include "torque-generated/src/objects/microtask-tq.inc"
20 
21 // Abstract base class for all microtasks that can be scheduled on the
22 // microtask queue. This class merely serves the purpose of a marker
23 // interface.
24 class Microtask : public TorqueGeneratedMicrotask<Microtask, Struct> {
25  public:
26   TQ_OBJECT_CONSTRUCTORS(Microtask)
27 };
28 
29 // A CallbackTask is a special Microtask that allows us to schedule
30 // C++ microtask callbacks on the microtask queue. This is heavily
31 // used by Blink for example.
32 class CallbackTask
33     : public TorqueGeneratedCallbackTask<CallbackTask, Microtask> {
34  public:
35   using BodyDescriptor = StructBodyDescriptor;
36 
37   TQ_OBJECT_CONSTRUCTORS(CallbackTask)
38 };
39 
40 // A CallableTask is a special (internal) Microtask that allows us to
41 // schedule arbitrary callables on the microtask queue. We use this
42 // for various tests of the microtask queue.
43 class CallableTask
44     : public TorqueGeneratedCallableTask<CallableTask, Microtask> {
45  public:
46   // Dispatched behavior.
47   DECL_VERIFIER(CallableTask)
48   void BriefPrintDetails(std::ostream& os);
49 
50   using BodyDescriptor = StructBodyDescriptor;
51 
52   TQ_OBJECT_CONSTRUCTORS(CallableTask)
53 };
54 
55 }  // namespace internal
56 }  // namespace v8
57 
58 #include "src/objects/object-macros-undef.h"
59 
60 #endif  // V8_OBJECTS_MICROTASK_H_
61