message_pump_for_ui.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2018 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_FOR_UI_H_
  5. #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_FOR_UI_H_
  6. // This header is a forwarding header to coalesce the various platform specific
  7. // implementations of MessagePumpForUI.
  8. #include "build/build_config.h"
  9. #if BUILDFLAG(IS_WIN)
  10. #include "base/message_loop/message_pump_win.h"
  11. #elif BUILDFLAG(IS_ANDROID)
  12. #include "base/message_loop/message_pump_android.h"
  13. #elif BUILDFLAG(IS_APPLE)
  14. #include "base/message_loop/message_pump.h"
  15. #elif BUILDFLAG(IS_NACL) || BUILDFLAG(IS_AIX)
  16. // No MessagePumpForUI, see below.
  17. #elif defined(USE_GLIB)
  18. #include "base/message_loop/message_pump_glib.h"
  19. #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
  20. #include "base/message_loop/message_pump_libevent.h"
  21. #elif BUILDFLAG(IS_FUCHSIA)
  22. #include "base/message_loop/message_pump_fuchsia.h"
  23. #endif
  24. namespace base {
  25. #if BUILDFLAG(IS_WIN)
  26. // Windows defines it as-is.
  27. using MessagePumpForUI = MessagePumpForUI;
  28. #elif BUILDFLAG(IS_ANDROID)
  29. // Android defines it as-is.
  30. using MessagePumpForUI = MessagePumpForUI;
  31. #elif BUILDFLAG(IS_APPLE)
  32. // MessagePumpForUI isn't bound to a specific impl on Mac. While each impl can
  33. // be represented by a plain MessagePump: MessagePumpMac::Create() must be used
  34. // to instantiate the right impl.
  35. using MessagePumpForUI = MessagePump;
  36. #elif BUILDFLAG(IS_NACL) || BUILDFLAG(IS_AIX)
  37. // Currently NaCl and AIX don't have a MessagePumpForUI.
  38. // TODO(abarth): Figure out if we need this.
  39. #elif defined(USE_GLIB)
  40. using MessagePumpForUI = MessagePumpGlib;
  41. #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
  42. using MessagePumpForUI = MessagePumpLibevent;
  43. #elif BUILDFLAG(IS_FUCHSIA)
  44. using MessagePumpForUI = MessagePumpFuchsia;
  45. #else
  46. #error Platform does not define MessagePumpForUI
  47. #endif
  48. } // namespace base
  49. #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_FOR_UI_H_