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

Side by Side Diff: third_party/WebKit/public/platform/WebViewScheduler.h

Issue 2109843003: Adds enableVirtualTime and setVirtualTimePolicy To Emulation domain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
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 WebViewScheduler_h 5 #ifndef WebViewScheduler_h
6 #define WebViewScheduler_h 6 #define WebViewScheduler_h
7 7
8 #include "WebCommon.h" 8 #include "WebCommon.h"
9 #include "public/platform/BlameContext.h" 9 #include "public/platform/BlameContext.h"
10 10
11 #if INSIDE_BLINK
12 #include "wtf/Forward.h"
13 #endif
14
11 #include <memory> 15 #include <memory>
12 16
13 namespace blink { 17 namespace blink {
14 18
15 class WebFrameScheduler; 19 class WebFrameScheduler;
16 20
17 class BLINK_PLATFORM_EXPORT WebViewScheduler { 21 class BLINK_PLATFORM_EXPORT WebViewScheduler {
18 public: 22 public:
23 WebViewScheduler();
19 virtual ~WebViewScheduler() { } 24 virtual ~WebViewScheduler() { }
20 25
21 // The scheduler may throttle tasks associated with background pages. 26 // The scheduler may throttle tasks associated with background pages.
22 virtual void setPageVisible(bool) = 0; 27 virtual void setPageVisible(bool) = 0;
23 28
24 // Creates a new WebFrameScheduler. The caller is responsible for deleting 29 // Creates a new WebFrameScheduler. The caller is responsible for deleting
25 // it. All tasks executed by the frame scheduler will be attributed to 30 // it. All tasks executed by the frame scheduler will be attributed to
26 // |BlameContext|. 31 // |BlameContext|.
27 virtual std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext *) = 0; 32 virtual std::unique_ptr<WebFrameScheduler> createFrameScheduler(BlameContext *) = 0;
28 33
29 // Instructs this WebViewScheduler to use virtual time. When virtual time is enabled 34 // Instructs this WebViewScheduler to use virtual time. When virtual time is enabled
30 // the system doesn't actually sleep for the delays between tasks before exe cuting 35 // the system doesn't actually sleep for the delays between tasks before exe cuting
31 // them. E.g: A-E are delayed tasks 36 // them. E.g: A-E are delayed tasks
32 // 37 //
33 // | A B C D E (normal) 38 // | A B C D E (normal)
34 // |-----------------------------> time 39 // |-----------------------------> time
35 // 40 //
36 // |ABCDE (virtual time) 41 // |ABCDE (virtual time)
37 // |-----------------------------> time 42 // |-----------------------------> time
38 virtual void enableVirtualTime() = 0; 43 virtual void enableVirtualTime() = 0;
39 44
40 // Controls whether or not virtual time is allowed to advance. If virtual ti me 45 // Controls whether or not virtual time is allowed to advance. If virtual ti me
41 // is not allowed to advance then delayed tasks posted to the WebTaskRunners owned 46 // is not allowed to advance then delayed tasks posted to the WebTaskRunners owned
42 // by any child WebFrameSchedulers will be paused. If virtual time is allowe d to 47 // by any child WebFrameSchedulers will be paused. If virtual time is allowe d to
43 // advance then tasks will be run in time order (as usual) but virtual time will 48 // advance then tasks will be run in time order (as usual) but virtual time will
44 // fast forward so that the system doesn't actually sleep for the delays bet ween 49 // fast forward so that the system doesn't actually sleep for the delays bet ween
45 // tasks before executing them. 50 // tasks before executing them.
46 virtual void setAllowVirtualTimeToAdvance(bool) = 0; 51 virtual void setAllowVirtualTimeToAdvance(bool) = 0;
52
53 void incrementPendingResorceLoadCount();
Sami 2016/06/29 16:22:27 typo: Resource
alex clarke (OOO till 29th) 2016/06/29 17:08:31 Done.
54 void decrementPendingResorceLoadCount();
55
56 enum class VirtualTimePolicy {
57 ADVANCE,
58 PAUSE,
59 PAUSE_IF_NETWORK_FETCHES_PENDING
60 };
61
62 void setVirtualTimePolicy(VirtualTimePolicy);
63
64 #ifdef INSIDE_BLINK
65 void setVirtualTimePolicy(const WTF::String&);
66 #endif
67
68 private:
69 int m_pendingResourceLoadCount;
70 VirtualTimePolicy m_virtualTimePolicy;
47 }; 71 };
48 72
49 } // namespace blink 73 } // namespace blink
50 74
51 #endif // WebViewScheduler 75 #endif // WebViewScheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698