blob: f3e3f040e61e2932e9e8c47b1c086802bae67b36 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// 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_ACTIVE_SCRIPT_WRAPPABLE_BASE_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_ACTIVE_SCRIPT_WRAPPABLE_BASE_H_
#include "base/macros.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "v8/include/v8.h"
namespace blink {
class ScriptWrappable;
class Visitor;
/**
* Classes deriving from ActiveScriptWrappable will be registered in a
* thread-specific list. They keep their wrappers and dependant objects alive
* as long as they have pending activity.
*/
class PLATFORM_EXPORT ActiveScriptWrappableBase : public GarbageCollectedMixin {
public:
static void TraceActiveScriptWrappables(v8::Isolate*, Visitor*);
virtual ~ActiveScriptWrappableBase() = default;
protected:
ActiveScriptWrappableBase();
virtual bool IsContextDestroyed() const = 0;
virtual bool DispatchHasPendingActivity() const = 0;
virtual ScriptWrappable* ToScriptWrappable() = 0;
private:
DISALLOW_COPY_AND_ASSIGN(ActiveScriptWrappableBase);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_ACTIVE_SCRIPT_WRAPPABLE_BASE_H_