Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h

Issue 2163983004: Pass per-frame task runners to Workers (when possible) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h
diff --git a/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h b/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd0cc994bdbbea73f8dab7fbed074ff0307ba320
--- /dev/null
+++ b/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h
@@ -0,0 +1,48 @@
+// 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 ParentFrameTaskRunners_h
+#define ParentFrameTaskRunners_h
+
+#include "core/CoreExport.h"
+#include "wtf/Allocator.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PtrUtil.h"
+#include <memory>
+
+namespace blink {
+
+class Document;
+class WebTaskRunner;
+
+// Represents a set of task runners of the parent (or associated) document's
+// frame. This could be accessed from worker thread(s) and must be initialized
+// on the parent context thread (i.e. MainThread) on construction time, rather
+// than being done lazily.
+class CORE_EXPORT ParentFrameTaskRunners final {
+ WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners);
+ USING_FAST_MALLOC(ParentFrameTaskRunners);
+public:
+ static std::unique_ptr<ParentFrameTaskRunners> create(Document* document)
+ {
+ return wrapUnique(new ParentFrameTaskRunners(document));
+ }
+
+ ~ParentFrameTaskRunners();
+
+ WebTaskRunner* getUnthrottledTaskRunner();
+ WebTaskRunner* getTimerTaskRunner();
+ WebTaskRunner* getLoadingTaskRunner();
+
+private:
+ ParentFrameTaskRunners(Document*);
+
+ std::unique_ptr<WebTaskRunner> m_unthrottledTaskRunner;
+ std::unique_ptr<WebTaskRunner> m_timerTaskRunner;
+ std::unique_ptr<WebTaskRunner> m_loadingTaskRunner;
+};
+
+} // namespace blink
+
+#endif // ParentFrameTaskRunners_h

Powered by Google App Engine
This is Rietveld 408576698