Fold NativeViewport application into ViewManager application.
[chromium-blink-merge.git] / jingle / glue / task_pump.h
blobb102605c8d86dbcaf5d55d931f92b43b7bf65965
1 // Copyright (c) 2012 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.
5 #ifndef JINGLE_GLUE_TASK_PUMP_H_
6 #define JINGLE_GLUE_TASK_PUMP_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "third_party/webrtc/base/taskrunner.h"
13 namespace jingle_glue {
15 // rtc::TaskRunner implementation that works on chromium threads.
16 class TaskPump : public rtc::TaskRunner, public base::NonThreadSafe {
17 public:
18 TaskPump();
20 ~TaskPump() override;
22 // rtc::TaskRunner implementation.
23 void WakeTasks() override;
24 int64 CurrentTime() override;
26 // No tasks will be processed after this is called, even if
27 // WakeTasks() is called.
28 void Stop();
30 private:
31 void CheckAndRunTasks();
33 bool posted_wake_;
34 bool stopped_;
36 base::WeakPtrFactory<TaskPump> weak_factory_;
38 DISALLOW_COPY_AND_ASSIGN(TaskPump);
41 } // namespace jingle_glue
43 #endif // JINGLE_GLUE_TASK_PUMP_H_