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.

     1 // Copyright (c) 2010 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 BASE_MESSAGE_PUMP_ANDROID_H_
     6 #define BASE_MESSAGE_PUMP_ANDROID_H_
     8 #include "base/message_pump.h"
     9 #include "base/time.h"
    11 namespace base {
    13 class MessagePumpForUI;
    15 class MessagePumpAndroid {
    17  public:
    18   MessagePumpAndroid(MessagePumpForUI &pump);
    19   ~MessagePumpAndroid();
    21  private:
    22   base::MessagePumpForUI &pump;
    23 };
    25 // This class implements a MessagePump needed for TYPE_UI MessageLoops on
    26 // Android
    27 class MessagePumpForUI : public MessagePump {
    29  public:
    30   MessagePumpForUI();
    31   ~MessagePumpForUI();
    33   virtual void Run(Delegate* delegate);
    34   virtual void Quit();
    35   virtual void ScheduleWork();
    36   virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
    38   // Internal methods used for processing the pump callbacks.  They are
    39   // public for simplicity but should not be used directly.
    40   // HandleDispatch is called after the poll has completed.
    41   void HandleDispatch();
    43  private:
    44   // We may make recursive calls to Run, so we save state that needs to be
    45   // separate between them in this structure type.
    46   struct RunState {
    47     Delegate* delegate;
    49     // Used to flag that the current Run() invocation should return ASAP.
    50     bool should_quit;
    52     // Used to count how many Run() invocations are on the stack.
    53     int run_depth;
    55     // Used internally for controlling whether we want a message pump
    56     // iteration to be blocking or not.
    57     bool more_work_is_plausible;
    58   };
    60   RunState* state_;
    62   // This is the time when we need to do delayed work.
    63   TimeTicks delayed_work_time_;
    65   bool work_scheduled;
    67   // MessagePump implementation for Android based on the GLib implement.
    68   MessagePumpAndroid pump;
    70   DISALLOW_COPY_AND_ASSIGN(MessagePumpForUI);
    71 };
    73 }  // namespace base
    75 #endif  // BASE_MESSAGE_PUMP_ANDROID_H_

mercurial