• 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 #include "config.h"
6 
7 #include "public/platform/WebSchedulerProxy.h"
8 
9 #include "platform/TraceLocation.h"
10 #include "platform/scheduler/Scheduler.h"
11 #include "public/platform/WebTraceLocation.h"
12 #include "wtf/Assertions.h"
13 #include "wtf/PassOwnPtr.h"
14 
15 namespace blink {
16 namespace {
17 
runTask(PassOwnPtr<WebThread::Task> task)18 void runTask(PassOwnPtr<WebThread::Task> task)
19 {
20     task->run();
21 }
22 
23 } // namespace
24 
create()25 WebSchedulerProxy WebSchedulerProxy::create()
26 {
27     return WebSchedulerProxy();
28 }
29 
WebSchedulerProxy()30 WebSchedulerProxy::WebSchedulerProxy()
31     : m_scheduler(Scheduler::shared())
32 {
33     ASSERT(m_scheduler);
34 }
35 
~WebSchedulerProxy()36 WebSchedulerProxy::~WebSchedulerProxy()
37 {
38 }
39 
postInputTask(const WebTraceLocation & webLocation,WebThread::Task * task)40 void WebSchedulerProxy::postInputTask(const WebTraceLocation& webLocation, WebThread::Task* task)
41 {
42     TraceLocation location(webLocation.functionName(), webLocation.fileName());
43     m_scheduler->postInputTask(location, bind(&runTask, adoptPtr(task)));
44 }
45 
postCompositorTask(const WebTraceLocation & webLocation,WebThread::Task * task)46 void WebSchedulerProxy::postCompositorTask(const WebTraceLocation& webLocation, WebThread::Task* task)
47 {
48     TraceLocation location(webLocation.functionName(), webLocation.fileName());
49     m_scheduler->postCompositorTask(location, bind(&runTask, adoptPtr(task)));
50 }
51 
postIpcTask(const WebTraceLocation & webLocation,WebThread::Task * task)52 void WebSchedulerProxy::postIpcTask(const WebTraceLocation& webLocation, WebThread::Task* task)
53 {
54     TraceLocation location(webLocation.functionName(), webLocation.fileName());
55     m_scheduler->postIpcTask(location, bind(&runTask, adoptPtr(task)));
56 }
57 
didReceiveInputEvent()58 void WebSchedulerProxy::didReceiveInputEvent()
59 {
60     m_scheduler->didReceiveInputEvent();
61 }
62 
63 } // namespace blink
64