| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebFrameScheduler_h | 5 #ifndef WebFrameScheduler_h |
| 6 #define WebFrameScheduler_h | 6 #define WebFrameScheduler_h |
| 7 | 7 |
| 8 #include "platform/wtf/RefPtr.h" | 8 #include "platform/wtf/RefPtr.h" |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // Set whether this frame is suspended. Only unthrottledTaskRunner tasks are | 37 // Set whether this frame is suspended. Only unthrottledTaskRunner tasks are |
| 38 // allowed to run on a suspended frame. | 38 // allowed to run on a suspended frame. |
| 39 virtual void SetSuspended(bool) {} | 39 virtual void SetSuspended(bool) {} |
| 40 | 40 |
| 41 // Set whether this frame is cross origin w.r.t. the top level frame. Cross | 41 // Set whether this frame is cross origin w.r.t. the top level frame. Cross |
| 42 // origin frames may use a different scheduling policy from same origin | 42 // origin frames may use a different scheduling policy from same origin |
| 43 // frames. | 43 // frames. |
| 44 virtual void SetCrossOrigin(bool) {} | 44 virtual void SetCrossOrigin(bool) {} |
| 45 | 45 |
| 46 // The tasks runners below are listed in increasing QoS order. |
| 47 // - timer task queue. Designed for custom user-provided javascript tasks. |
| 48 // Lowest guarantees. Can be suspended, blocked during user gesture or |
| 49 // throttled when backgrounded. |
| 50 // - loading task queue. Can be suspended or blocked during user gesture. |
| 51 // Throttling might be considered in the future. |
| 52 // - suspendable task queue. Can be suspended and blocked during user gesture, |
| 53 // can't be throttled. |
| 54 // - unthrottled-but-blockable task queue. Can't be throttled, can't |
| 55 // be suspended but can be blocked during user gesture. |
| 56 // NOTE: existence of this queue is a temporary fix for scroll latency |
| 57 // regression. All tasks should be moved from this queue to suspendable |
| 58 // or unthrottled queues and it should be deleted. |
| 59 // - unthrottled task queue. Highest guarantees. Can't be throttled, |
| 60 // suspended or blocked. Should be used only when necessary after |
| 61 // consulting scheduler-dev@. |
| 62 |
| 63 // Returns the WebTaskRunner for timer tasks. |
| 64 // WebFrameScheduler owns the returned WebTaskRunner. |
| 65 virtual RefPtr<WebTaskRunner> TimerTaskRunner() = 0; |
| 66 |
| 46 // Returns the WebTaskRunner for loading tasks. | 67 // Returns the WebTaskRunner for loading tasks. |
| 47 // WebFrameScheduler owns the returned WebTaskRunner. | 68 // WebFrameScheduler owns the returned WebTaskRunner. |
| 48 virtual RefPtr<WebTaskRunner> LoadingTaskRunner() = 0; | 69 virtual RefPtr<WebTaskRunner> LoadingTaskRunner() = 0; |
| 49 | 70 |
| 50 // Returns the WebTaskRunner for timer tasks. | |
| 51 // WebFrameScheduler owns the returned WebTaskRunner. | |
| 52 virtual RefPtr<WebTaskRunner> TimerTaskRunner() = 0; | |
| 53 | |
| 54 // Returns the WebTaskRunner for tasks which shouldn't get throttled, | 71 // Returns the WebTaskRunner for tasks which shouldn't get throttled, |
| 55 // but can be suspended. | 72 // but can be suspended. |
| 56 // TODO(altimin): This is a transitional task runner. Unthrottled task runner | 73 // TODO(altimin): This is a transitional task runner. Unthrottled task runner |
| 57 // would become suspendable in the nearest future and a new unsuspended | 74 // would become suspendable in the nearest future and a new unsuspended |
| 58 // task runner will be added. | 75 // task runner will be added. |
| 59 virtual RefPtr<WebTaskRunner> SuspendableTaskRunner() = 0; | 76 virtual RefPtr<WebTaskRunner> SuspendableTaskRunner() = 0; |
| 60 | 77 |
| 78 // Retuns the WebTaskRunner for tasks which should not be suspended or |
| 79 // throttled, but should be blocked during user gesture. |
| 80 // This is a temporary task runner needed for a fix for touch latency |
| 81 // regression. All tasks from it should be moved to suspendable or |
| 82 // unthrottled task runner. |
| 83 virtual RefPtr<WebTaskRunner> UnthrottledButBlockableTaskRunner() = 0; |
| 84 |
| 61 // Returns the WebTaskRunner for tasks which should never get throttled. | 85 // Returns the WebTaskRunner for tasks which should never get throttled. |
| 62 // This is generally used for executing internal browser tasks which should | 86 // This is generally used for executing internal browser tasks which should |
| 63 // never be throttled. Ideally only tasks whose performance characteristics | 87 // never be throttled. Ideally only tasks whose performance characteristics |
| 64 // are known should be posted to this task runner; for example user | 88 // are known should be posted to this task runner; for example user |
| 65 // JavaScript is discouraged. WebFrameScheduler owns the returned | 89 // JavaScript is discouraged. WebFrameScheduler owns the returned |
| 66 // WebTaskRunner. | 90 // WebTaskRunner. |
| 67 virtual RefPtr<WebTaskRunner> UnthrottledTaskRunner() = 0; | 91 virtual RefPtr<WebTaskRunner> UnthrottledTaskRunner() = 0; |
| 68 | 92 |
| 69 // Returns the parent WebViewScheduler. | 93 // Returns the parent WebViewScheduler. |
| 70 virtual WebViewScheduler* GetWebViewScheduler() { return nullptr; } | 94 virtual WebViewScheduler* GetWebViewScheduler() { return nullptr; } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 90 // connection (websocket, webrtc, etc). When connection is closed this handle | 114 // connection (websocket, webrtc, etc). When connection is closed this handle |
| 91 // must be destroyed. | 115 // must be destroyed. |
| 92 virtual std::unique_ptr<ActiveConnectionHandle> OnActiveConnectionCreated() { | 116 virtual std::unique_ptr<ActiveConnectionHandle> OnActiveConnectionCreated() { |
| 93 return nullptr; | 117 return nullptr; |
| 94 }; | 118 }; |
| 95 }; | 119 }; |
| 96 | 120 |
| 97 } // namespace blink | 121 } // namespace blink |
| 98 | 122 |
| 99 #endif // WebFrameScheduler_h | 123 #endif // WebFrameScheduler_h |
| OLD | NEW |