blob: e651ddaafb7c8f9e278e8c39bf3e01ab35b45cf1 [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 WorkletGlobalScopeProxy_h
#define WorkletGlobalScopeProxy_h
#include "core/CoreExport.h"
#include "platform/weborigin/KURL.h"
#include "public/platform/WebURLRequest.h"
namespace blink {
class ScriptSourceCode;
class WorkletPendingTasks;
// Abstracts communication from (Main/Threaded)Worklet on the main thread to
// (Main/Threaded)WorkletGlobalScope so that Worklet class doesn't have to care
// about the thread WorkletGlobalScope runs on.
class CORE_EXPORT WorkletGlobalScopeProxy {
virtual ~WorkletGlobalScopeProxy() {}
// Runs the "fetch and invoke a worklet script" algorithm:
virtual void FetchAndInvokeScript(const KURL& module_url_record,
WorkletPendingTasks*) {}
// Evaluates the given script source code. This should be called only for
// threaded worklets that still use classic script loading.
virtual void EvaluateScript(const ScriptSourceCode&) = 0;
// Terminates the worklet global scope from the main thread.
virtual void TerminateWorkletGlobalScope() = 0;
} // namespace blink
#endif // WorkletGlobalScopeProxy_h