ipc/chromium/src/base/message_pump_android.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #ifndef BASE_MESSAGE_PUMP_ANDROID_H_
michael@0 6 #define BASE_MESSAGE_PUMP_ANDROID_H_
michael@0 7
michael@0 8 #include "base/message_pump.h"
michael@0 9 #include "base/time.h"
michael@0 10
michael@0 11 namespace base {
michael@0 12
michael@0 13 class MessagePumpForUI;
michael@0 14
michael@0 15 class MessagePumpAndroid {
michael@0 16
michael@0 17 public:
michael@0 18 MessagePumpAndroid(MessagePumpForUI &pump);
michael@0 19 ~MessagePumpAndroid();
michael@0 20
michael@0 21 private:
michael@0 22 base::MessagePumpForUI &pump;
michael@0 23 };
michael@0 24
michael@0 25 // This class implements a MessagePump needed for TYPE_UI MessageLoops on
michael@0 26 // Android
michael@0 27 class MessagePumpForUI : public MessagePump {
michael@0 28
michael@0 29 public:
michael@0 30 MessagePumpForUI();
michael@0 31 ~MessagePumpForUI();
michael@0 32
michael@0 33 virtual void Run(Delegate* delegate);
michael@0 34 virtual void Quit();
michael@0 35 virtual void ScheduleWork();
michael@0 36 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
michael@0 37
michael@0 38 // Internal methods used for processing the pump callbacks. They are
michael@0 39 // public for simplicity but should not be used directly.
michael@0 40 // HandleDispatch is called after the poll has completed.
michael@0 41 void HandleDispatch();
michael@0 42
michael@0 43 private:
michael@0 44 // We may make recursive calls to Run, so we save state that needs to be
michael@0 45 // separate between them in this structure type.
michael@0 46 struct RunState {
michael@0 47 Delegate* delegate;
michael@0 48
michael@0 49 // Used to flag that the current Run() invocation should return ASAP.
michael@0 50 bool should_quit;
michael@0 51
michael@0 52 // Used to count how many Run() invocations are on the stack.
michael@0 53 int run_depth;
michael@0 54
michael@0 55 // Used internally for controlling whether we want a message pump
michael@0 56 // iteration to be blocking or not.
michael@0 57 bool more_work_is_plausible;
michael@0 58 };
michael@0 59
michael@0 60 RunState* state_;
michael@0 61
michael@0 62 // This is the time when we need to do delayed work.
michael@0 63 TimeTicks delayed_work_time_;
michael@0 64
michael@0 65 bool work_scheduled;
michael@0 66
michael@0 67 // MessagePump implementation for Android based on the GLib implement.
michael@0 68 MessagePumpAndroid pump;
michael@0 69
michael@0 70 DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
michael@0 71 };
michael@0 72
michael@0 73 } // namespace base
michael@0 74
michael@0 75 #endif // BASE_MESSAGE_PUMP_ANDROID_H_

mercurial