summaryrefslogtreecommitdiff
path: root/Source/WebCore/workers/Worker.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/workers/Worker.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/workers/Worker.h')
-rw-r--r--Source/WebCore/workers/Worker.h86
1 files changed, 45 insertions, 41 deletions
diff --git a/Source/WebCore/workers/Worker.h b/Source/WebCore/workers/Worker.h
index c197eef6b..44d86f8e7 100644
--- a/Source/WebCore/workers/Worker.h
+++ b/Source/WebCore/workers/Worker.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2010, 2016 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -21,66 +21,70 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
*/
-#ifndef Worker_h
-#define Worker_h
+#pragma once
#include "AbstractWorker.h"
#include "ActiveDOMObject.h"
-#include "EventListener.h"
-#include "EventNames.h"
+#include "ContentSecurityPolicyResponseHeaders.h"
#include "EventTarget.h"
#include "MessagePort.h"
#include "WorkerScriptLoaderClient.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
+#include <runtime/RuntimeFlags.h>
+#include <wtf/Optional.h>
#include <wtf/text/AtomicStringHash.h>
+namespace JSC {
+class ExecState;
+class JSObject;
+class JSValue;
+}
+
namespace WebCore {
- class ScriptExecutionContext;
- class WorkerGlobalScopeProxy;
- class WorkerScriptLoader;
+class ScriptExecutionContext;
+class WorkerGlobalScopeProxy;
+class WorkerScriptLoader;
- typedef int ExceptionCode;
+class Worker final : public AbstractWorker, public ActiveDOMObject, private WorkerScriptLoaderClient {
+public:
+ static ExceptionOr<Ref<Worker>> create(ScriptExecutionContext&, const String& url, JSC::RuntimeFlags);
+ virtual ~Worker();
- class Worker final : public AbstractWorker, private WorkerScriptLoaderClient {
- public:
- static PassRefPtr<Worker> create(ScriptExecutionContext&, const String& url, ExceptionCode&);
- virtual ~Worker();
+ ExceptionOr<void> postMessage(JSC::ExecState&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&&);
- virtual EventTargetInterface eventTargetInterface() const override { return WorkerEventTargetInterfaceType; }
+ void terminate();
- void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionCode&);
- // Needed for Objective-C bindings (see bug 28774).
- void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*, ExceptionCode&);
+ bool hasPendingActivity() const final;
- void terminate();
+ String identifier() const { return m_identifier; }
- virtual bool canSuspend() const override;
- virtual void stop() override;
- virtual bool hasPendingActivity() const override;
-
- DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
+ ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
- private:
- explicit Worker(ScriptExecutionContext&);
+private:
+ explicit Worker(ScriptExecutionContext&, JSC::RuntimeFlags);
- void notifyNetworkStateChange(bool isOnline);
+ EventTargetInterface eventTargetInterface() const final { return WorkerEventTargetInterfaceType; }
- // WorkerScriptLoaderClient callbacks
- virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) override;
- virtual void notifyFinished() override;
+ void notifyNetworkStateChange(bool isOnline);
- friend void networkStateChanged(bool isOnLine);
+ void didReceiveResponse(unsigned long identifier, const ResourceResponse&) final;
+ void notifyFinished() final;
- RefPtr<WorkerScriptLoader> m_scriptLoader;
- WorkerGlobalScopeProxy* m_contextProxy; // The proxy outlives the worker to perform thread shutdown.
- };
+ bool canSuspendForDocumentSuspension() const final;
+ void stop() final;
+ const char* activeDOMObjectName() const final;
-} // namespace WebCore
+ friend void networkStateChanged(bool isOnLine);
-#endif // Worker_h
+ RefPtr<WorkerScriptLoader> m_scriptLoader;
+ String m_identifier;
+ WorkerGlobalScopeProxy& m_contextProxy; // The proxy outlives the worker to perform thread shutdown.
+ std::optional<ContentSecurityPolicyResponseHeaders> m_contentSecurityPolicyResponseHeaders;
+ MonotonicTime m_workerCreationTime;
+ bool m_shouldBypassMainWorldContentSecurityPolicy { false };
+ JSC::RuntimeFlags m_runtimeFlags;
+};
+
+} // namespace WebCore