OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ParentFrameTaskRunners_h | |
6 #define ParentFrameTaskRunners_h | |
7 | |
8 #include "core/CoreExport.h" | |
9 #include "wtf/Allocator.h" | |
10 #include "wtf/Noncopyable.h" | |
11 #include "wtf/PtrUtil.h" | |
12 #include <memory> | |
13 | |
14 namespace blink { | |
15 | |
16 class Document; | |
17 class WebTaskRunner; | |
18 | |
19 // Represents a set of task runners of the parent (or associated) document's | |
20 // frame. This could be accessed from worker thread(s) and must be initialized | |
21 // on the parent context thread (i.e. MainThread) on construction time, rather | |
22 // than being done lazily. | |
23 class CORE_EXPORT ParentFrameTaskRunners final { | |
24 WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners); | |
25 USING_FAST_MALLOC(ParentFrameTaskRunners); | |
26 public: | |
27 static std::unique_ptr<ParentFrameTaskRunners> create(Document* document) | |
28 { | |
29 return wrapUnique(new ParentFrameTaskRunners(document)); | |
30 } | |
31 | |
32 ~ParentFrameTaskRunners(); | |
33 | |
34 WebTaskRunner* getUnthrottledTaskRunner(); | |
35 WebTaskRunner* getTimerTaskRunner(); | |
36 WebTaskRunner* getLoadingTaskRunner(); | |
37 | |
38 private: | |
39 ParentFrameTaskRunners(Document*); | |
40 | |
41 std::unique_ptr<WebTaskRunner> m_unthrottledTaskRunner; | |
42 std::unique_ptr<WebTaskRunner> m_timerTaskRunner; | |
43 std::unique_ptr<WebTaskRunner> m_loadingTaskRunner; | |
44 }; | |
45 | |
46 } // namespace blink | |
47 | |
48 #endif // ParentFrameTaskRunners_h | |
OLD | NEW |