blob: c0f7ed63862e08ff08bf960d2ba5460074016927 [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 WorkerOrWorkletGlobalScope_h
#define WorkerOrWorkletGlobalScope_h
#include "core/dom/ExecutionContext.h"
namespace blink {
class ScriptWrappable;
class WorkerOrWorkletScriptController;
class CORE_EXPORT WorkerOrWorkletGlobalScope : public ExecutionContext {
public:
virtual ScriptWrappable* getScriptWrappable() const = 0;
virtual WorkerOrWorkletScriptController* scriptController() = 0;
// Returns true when the WorkerOrWorkletGlobalScope is closing (e.g. via
// WorkerGlobalScope#close() method). If this returns true, the worker is
// going to be shutdown after the current task execution. Globals that
// don't support close operation should always return false.
virtual bool isClosing() const = 0;
// Should be called before destroying the global scope object. Allows
// sub-classes to perform any cleanup needed.
virtual void dispose() = 0;
};
DEFINE_TYPE_CASTS(WorkerOrWorkletGlobalScope, ExecutionContext, context, (context->isWorkerGlobalScope() || context->isWorkletGlobalScope()), (context.isWorkerGlobalScope() || context.isWorkletGlobalScope()));
} // namespace blink
#endif // WorkerOrWorkletGlobalScope_h