• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef WebSchedulerProxy_h
6 #define WebSchedulerProxy_h
7 
8 #include "WebThread.h"
9 
10 namespace blink {
11 
12 class Scheduler;
13 class WebTraceLocation;
14 
15 // This class is used to submit tasks to Blink's main thread scheduler.
16 class WebSchedulerProxy {
17 public:
18     BLINK_PLATFORM_EXPORT ~WebSchedulerProxy();
19 
20     BLINK_PLATFORM_EXPORT static WebSchedulerProxy create();
21 
22     // Schedule an input processing task to be run on the Blink main thread.
23     // Takes ownership of |Task|. Can be called from any thread.
24     BLINK_PLATFORM_EXPORT void postInputTask(const WebTraceLocation&, WebThread::Task*);
25 
26     // Schedule a compositor task to run on the Blink main thread. Takes
27     // ownership of |Task|. Can be called from any thread.
28     BLINK_PLATFORM_EXPORT void postCompositorTask(const WebTraceLocation&, WebThread::Task*);
29 
30     // Schedule an IPC task to be run on the Blink main thread.
31     // Takes ownership of |Task|. Can be called from any thread.
32     BLINK_PLATFORM_EXPORT void postIpcTask(const WebTraceLocation&, WebThread::Task*);
33 
34     // Tells the scheduler that the system received an input event and it should go into low latency mode for a while.
35     BLINK_PLATFORM_EXPORT void didReceiveInputEvent();
36 
37 private:
38     WebSchedulerProxy();
39 
40     Scheduler* m_scheduler;
41 };
42 
43 } // namespace blink
44 
45 #endif // WebSchedulerProxy_h
46