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

Unified 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: Fix test crash Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/public/platform/WebViewScheduler.h
diff --git a/third_party/WebKit/public/platform/WebViewScheduler.h b/third_party/WebKit/public/platform/WebViewScheduler.h
index 3635b784a04c751614fee6653e7850d56ea7553a..60d9f2ed2c142b9c6d7836b76c8b870461bcd963 100644
--- a/third_party/WebKit/public/platform/WebViewScheduler.h
+++ b/third_party/WebKit/public/platform/WebViewScheduler.h
@@ -8,6 +8,15 @@
#include "WebCommon.h"
#include "public/platform/BlameContext.h"
+#if INSIDE_BLINK
+#include "wtf/Forward.h"
+#include "wtf/WeakPtr.h"
+#else
+namespace WTF {
+template<typename T> class WeakPtrFactory;
+}
+#endif
+
#include <memory>
namespace blink {
@@ -16,7 +25,8 @@ class WebFrameScheduler;
class BLINK_PLATFORM_EXPORT WebViewScheduler {
public:
- virtual ~WebViewScheduler() { }
+ WebViewScheduler();
+ virtual ~WebViewScheduler();
// The scheduler may throttle tasks associated with background pages.
virtual void setPageVisible(bool) = 0;
@@ -44,6 +54,33 @@ public:
// fast forward so that the system doesn't actually sleep for the delays between
// tasks before executing them.
virtual void setAllowVirtualTimeToAdvance(bool) = 0;
+
+ // Returns true if virtual time is allowed to advance.
+ virtual bool virtualTimeAllowedToAdvance() const = 0;
+
+ void incrementPendingResourceLoadCount();
+ void decrementPendingResourceLoadCount();
+
+ enum class VirtualTimePolicy {
+ ADVANCE,
+ PAUSE,
+ PAUSE_IF_NETWORK_FETCHES_PENDING
+ };
+
+ void setVirtualTimePolicy(VirtualTimePolicy);
+
+#ifdef INSIDE_BLINK
+ void setVirtualTimePolicy(const WTF::String&);
+
+ WeakPtr<WebViewScheduler> createWeakPtr() { return m_weakPtrFactory->createWeakPtr(); }
+#endif
+
+private:
+ int m_pendingResourceLoadCount;
+ VirtualTimePolicy m_virtualTimePolicy;
+
+ // This is ugly. We can't use WTF types outside of blink but we can forward declare them.
+ std::unique_ptr<WTF::WeakPtrFactory<WebViewScheduler>> m_weakPtrFactory;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698