message_pump_default.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.
  4. #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
  5. #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
  6. #include "base/base_export.h"
  7. #include "base/macros.h"
  8. #include "base/message_loop/message_pump.h"
  9. #include "base/synchronization/waitable_event.h"
  10. #include "base/time/time.h"
  11. #include "build/build_config.h"
  12. namespace base {
  13. class BASE_EXPORT MessagePumpDefault : public MessagePump {
  14. public:
  15. MessagePumpDefault();
  16. ~MessagePumpDefault() override;
  17. // MessagePump methods:
  18. void Run(Delegate* delegate) override;
  19. void Quit() override;
  20. void ScheduleWork() override;
  21. void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override;
  22. #if defined(OS_APPLE)
  23. void SetTimerSlack(TimerSlack timer_slack) override;
  24. #endif
  25. private:
  26. // This flag is set to false when Run should return.
  27. bool keep_running_;
  28. // Used to sleep until there is more work to do.
  29. WaitableEvent event_;
  30. DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault);
  31. };
  32. } // namespace base
  33. #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_