summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/public/platform/WebFrameScheduler.h
blob: 05f2371bb2a2985391ed7ba2054ce9c7ac33317a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 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) { }

    // Tells the scheduler that the page this frame belongs to is not visible.
    // The scheduler may throttle tasks associated with pages that are not visible.
    virtual void setPageVisible(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