| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TaskRunnerHelper_h | 5 #ifndef TaskRunnerHelper_h |
| 6 #define TaskRunnerHelper_h | 6 #define TaskRunnerHelper_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/HashTraits.h" | 10 #include "wtf/HashTraits.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class Document; | 14 class Document; |
| 15 class ExecutionContext; | 15 class ExecutionContext; |
| 16 class Frame; |
| 16 class LocalFrame; | 17 class LocalFrame; |
| 17 class ScriptState; | 18 class ScriptState; |
| 18 class WebTaskRunner; | 19 class WebTaskRunner; |
| 19 | 20 |
| 20 enum class TaskType : unsigned { | 21 enum class TaskType : unsigned { |
| 21 // Speced tasks and related internal tasks should be posted to one of | 22 // Speced tasks and related internal tasks should be posted to one of |
| 22 // the following task runners. These task runners may be throttled. | 23 // the following task runners. These task runners may be throttled. |
| 23 DOMManipulation, | 24 DOMManipulation, |
| 24 UserInteraction, | 25 UserInteraction, |
| 25 Networking, | 26 Networking, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 // A set of helper functions to get a WebTaskRunner for TaskType and a context | 75 // A set of helper functions to get a WebTaskRunner for TaskType and a context |
| 75 // object. The posted tasks are guaranteed to run in a sequence if they have the | 76 // object. The posted tasks are guaranteed to run in a sequence if they have the |
| 76 // same TaskType and the context objects belong to the same frame. | 77 // same TaskType and the context objects belong to the same frame. |
| 77 class CORE_EXPORT TaskRunnerHelper final { | 78 class CORE_EXPORT TaskRunnerHelper final { |
| 78 STATIC_ONLY(TaskRunnerHelper); | 79 STATIC_ONLY(TaskRunnerHelper); |
| 79 | 80 |
| 80 public: | 81 public: |
| 81 static RefPtr<WebTaskRunner> get(TaskType, LocalFrame*); | 82 static RefPtr<WebTaskRunner> get(TaskType, LocalFrame*); |
| 83 static RefPtr<WebTaskRunner> get(TaskType, Frame*); |
| 82 static RefPtr<WebTaskRunner> get(TaskType, Document*); | 84 static RefPtr<WebTaskRunner> get(TaskType, Document*); |
| 83 static RefPtr<WebTaskRunner> get(TaskType, ExecutionContext*); | 85 static RefPtr<WebTaskRunner> get(TaskType, ExecutionContext*); |
| 84 static RefPtr<WebTaskRunner> get(TaskType, ScriptState*); | 86 static RefPtr<WebTaskRunner> get(TaskType, ScriptState*); |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } // namespace blink | 89 } // namespace blink |
| 88 | 90 |
| 89 #endif | 91 #endif |
| OLD | NEW |