// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_CALLBACK_FUNCTION_BASE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_CALLBACK_FUNCTION_BASE_H_ #include "base/functional/callback.h" #include "third_party/blink/public/common/scheduler/task_attribution_id.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" namespace blink { namespace scheduler { class TaskAttributionInfo; } // CallbackFunctionBase is the common base class of all the callback function // classes. Most importantly this class provides a way of type dispatching (e.g. // overload resolutions, SFINAE technique, etc.) so that it's possible to // distinguish callback functions from anything else. Also it provides a common // implementation of callback functions. // // This base class does not provide support for task attribution, so the // callback that require such a functionality should inherit from // CallbackFunctionWithTaskAttributionBase class. // // As the signatures of callback functions vary, this class does not implement // |Invoke| member function that performs "invoke" steps. Subclasses will // implement it. class PLATFORM_EXPORT CallbackFunctionBase : public GarbageCollected<CallbackFunctionBase>, public NameClient { … }; // CallbackFunctionWithTaskAttributionBase is the common base class of callback // function that require task attribution support. // Callbacks that require such a functionality should be defined with // [SupportsTaskAttribution] IDL extended attribute. class PLATFORM_EXPORT CallbackFunctionWithTaskAttributionBase : public CallbackFunctionBase { … }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_CALLBACK_FUNCTION_BASE_H_