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

Side by Side Diff: third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h

Issue 2236833002: Pass per-frame task runners to Workers (when possible) [2nd try] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, lifecycle observer + TaskType Created 4 years, 4 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 unified diff | Download patch
OLDNEW
(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 "core/dom/TaskRunnerHelper.h"
10 #include "platform/heap/Handle.h"
11 #include "wtf/Allocator.h"
12 #include "wtf/Noncopyable.h"
13 #include "wtf/PtrUtil.h"
14 #include <memory>
15
16 namespace blink {
17
18 class Document;
19 class WebTaskRunner;
20
21 // Represents a set of task runners of the parent (or associated) document's
22 // frame. This could be accessed from worker thread(s) and must be initialized
23 // on the parent context thread (i.e. MainThread) on construction time, rather
24 // than being done lazily.
25 class CORE_EXPORT ParentFrameTaskRunners final {
26 WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners);
27 USING_FAST_MALLOC(ParentFrameTaskRunners);
28 public:
29 static std::unique_ptr<ParentFrameTaskRunners> create(Document* document)
30 {
31 return wrapUnique(new ParentFrameTaskRunners(document));
32 }
33
34 ~ParentFrameTaskRunners();
35
36 WebTaskRunner* get(TaskType);
37
38 private:
39 class Observer;
40 explicit ParentFrameTaskRunners(Document*);
41
42 void contextDestroyed();
43
44 WebTaskRunner* m_unthrottledTaskRunner;
45 WebTaskRunner* m_timerTaskRunner;
46 WebTaskRunner* m_loadingTaskRunner;
47
48 // A ContextLifecycleObserver for resetting task runners when the
49 // parent context is detached.
50 Persistent<Observer> m_observer;
haraken 2016/08/11 14:57:43 It would be slightly better to put ParentFrameTask
kinuko 2016/08/11 23:21:37 Done.
51 };
52
53 } // namespace blink
54
55 #endif // ParentFrameTaskRunners_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698