Adds a WebPageScheduler and a WebFrameScheduler

These APIs are intended to support spatial scheduling and task attribution.

Chromium implementation: https://codereview.chromium.org/1314903007/

BUG=510398

Review URL: https://codereview.chromium.org/1316233010

git-svn-id: svn://svn.chromium.org/blink/trunk@201978 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2f357961
...@@ -131,6 +131,8 @@ source_set("blink_headers") { ...@@ -131,6 +131,8 @@ source_set("blink_headers") {
"platform/WebMediaStream.h", "platform/WebMediaStream.h",
"platform/WebServiceWorkerRegistration.h", "platform/WebServiceWorkerRegistration.h",
"platform/WebRect.h", "platform/WebRect.h",
"platform/WebPageScheduler.h",
"platform/WebFrameScheduler.h",
"platform/WebTaskRunner.h", "platform/WebTaskRunner.h",
"platform/WebThread.h", "platform/WebThread.h",
"platform/WebSetSinkIdError.h", "platform/WebSetSinkIdError.h",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WebFrameScheduler_h
#define WebFrameScheduler_h
#include "WebCommon.h"
#include <string>
namespace blink {
class WebSecurityOrigin;
class WebTaskRunner;
class BLINK_PLATFORM_EXPORT WebFrameScheduler {
public:
virtual ~WebFrameScheduler() { }
// The scheduler may throttle tasks associated with offscreen frames.
virtual void setFrameVisible(bool) { }
// Returns the WebTaskRunner for loading tasks.
// WebFrameScheduler owns the returned WebTaskRunner.
virtual WebTaskRunner* loadingTaskRunner() { return nullptr; }
// Returns the WebTaskRunner for timer tasks.
// WebFrameScheduler owns the returned WebTaskRunner.
virtual WebTaskRunner* timerTaskRunner() { return nullptr; }
// Record the current origin. This is for task attribution in tracing.
virtual void setFrameOrigin(const WebSecurityOrigin*) { }
};
} // namespace blink
#endif // WebFrameScheduler_h
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WebPageScheduler_h
#define WebPageScheduler_h
#include "WebCommon.h"
namespace blink {
class WebFrameScheduler;
class BLINK_PLATFORM_EXPORT WebPageScheduler {
public:
virtual ~WebPageScheduler() { }
// The scheduler may throttle tasks associated with backgound pages.
virtual void setPageInBackground(bool) { }
// Creaters a new WebFrameScheduler, the caller is responsible for deleting it.
WebFrameScheduler* createFrameScheduler() { return nullptr; }
};
} // namespace blink
#endif // WebPageScheduler_h
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
namespace blink { namespace blink {
class WebPageScheduler;
class WebTraceLocation; class WebTraceLocation;
// This class is used to submit tasks and pass other information from Blink to // This class is used to submit tasks and pass other information from Blink to
...@@ -72,6 +73,9 @@ public: ...@@ -72,6 +73,9 @@ public:
// Returns a WebTaskRunner for timer tasks. Can be called from any thread. // Returns a WebTaskRunner for timer tasks. Can be called from any thread.
virtual WebTaskRunner* timerTaskRunner() { return nullptr; } virtual WebTaskRunner* timerTaskRunner() { return nullptr; }
// Creates a new WebPageScheduler. Must be called from the associated WebThread.
virtual WebPageScheduler* createPageScheduler() { return nullptr; }
// Suspends the timer queue and increments the timer queue suspension count. // Suspends the timer queue and increments the timer queue suspension count.
// May only be called from the main thread. // May only be called from the main thread.
virtual void suspendTimerQueue() { } virtual void suspendTimerQueue() { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment