dbus_thread_linux.h 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2017 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 COMPONENTS_DBUS_THREAD_LINUX_DBUS_THREAD_LINUX_H_
  5. #define COMPONENTS_DBUS_THREAD_LINUX_DBUS_THREAD_LINUX_H_
  6. #include "base/component_export.h"
  7. #include "base/memory/ref_counted.h"
  8. #include "base/task/single_thread_task_runner.h"
  9. #include "build/build_config.h"
  10. #include "build/chromeos_buildflags.h"
  11. // Many APIs in ::dbus are required to be called from the same thread
  12. // (https://crbug.com/130984). Therefore, a SingleThreadedTaskRunner is
  13. // maintained and accessible through GetDBusTaskRunner(), from which all calls
  14. // to dbus on Linux have to be made.
  15. #if BUILDFLAG(IS_CHROMEOS_ASH)
  16. #error On ChromeOS, use DBusThreadManager instead.
  17. #endif
  18. namespace dbus_thread_linux {
  19. COMPONENT_EXPORT(DBUS)
  20. scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner();
  21. } // namespace dbus_thread_linux
  22. #endif // COMPONENTS_DBUS_THREAD_LINUX_DBUS_THREAD_LINUX_H_