summaryrefslogtreecommitdiff
path: root/Source/WebCore/workers/WorkerRunLoop.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/workers/WorkerRunLoop.h')
-rw-r--r--Source/WebCore/workers/WorkerRunLoop.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/Source/WebCore/workers/WorkerRunLoop.h b/Source/WebCore/workers/WorkerRunLoop.h
index 10aa81b54..317dfbd03 100644
--- a/Source/WebCore/workers/WorkerRunLoop.h
+++ b/Source/WebCore/workers/WorkerRunLoop.h
@@ -28,13 +28,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WorkerRunLoop_h
-#define WorkerRunLoop_h
+#pragma once
#include "ScriptExecutionContext.h"
+#include <memory>
#include <wtf/MessageQueue.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -58,26 +56,24 @@ namespace WebCore {
void terminate();
bool terminated() const { return m_messageQueue.killed(); }
- void postTask(PassOwnPtr<ScriptExecutionContext::Task>);
- void postTaskAndTerminate(PassOwnPtr<ScriptExecutionContext::Task>);
- void postTaskForMode(PassOwnPtr<ScriptExecutionContext::Task>, const String& mode);
+ void postTask(ScriptExecutionContext::Task&&);
+ void postTaskAndTerminate(ScriptExecutionContext::Task&&);
+ void postTaskForMode(ScriptExecutionContext::Task&&, const String& mode);
unsigned long createUniqueId() { return ++m_uniqueId; }
static String defaultMode();
+ static String debuggerMode();
class Task {
WTF_MAKE_NONCOPYABLE(Task); WTF_MAKE_FAST_ALLOCATED;
public:
- static std::unique_ptr<Task> create(PassOwnPtr<ScriptExecutionContext::Task>, const String& mode);
- ~Task() { }
+ Task(ScriptExecutionContext::Task&&, const String& mode);
const String& mode() const { return m_mode; }
- void performTask(const WorkerRunLoop&, ScriptExecutionContext*);
+ void performTask(const WorkerRunLoop&, WorkerGlobalScope*);
private:
- Task(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode);
-
- OwnPtr<ScriptExecutionContext::Task> m_task;
+ ScriptExecutionContext::Task m_task;
String m_mode;
};
@@ -89,12 +85,12 @@ namespace WebCore {
// This should only be called when the context is closed or loop has been terminated.
void runCleanupTasks(WorkerGlobalScope*);
+ bool isNested() const { return m_nestedCount > 1; }
+
MessageQueue<Task> m_messageQueue;
- OwnPtr<WorkerSharedTimer> m_sharedTimer;
+ std::unique_ptr<WorkerSharedTimer> m_sharedTimer;
int m_nestedCount;
unsigned long m_uniqueId;
};
} // namespace WebCore
-
-#endif // WorkerRunLoop_h