connection_scheduler.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2020 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 ASH_COMPONENTS_PHONEHUB_CONNECTION_SCHEDULER_H_
  5. #define ASH_COMPONENTS_PHONEHUB_CONNECTION_SCHEDULER_H_
  6. namespace ash {
  7. namespace phonehub {
  8. // Responsible for requesting connection from the local device
  9. // (e.g. this chromebook) to the user's phone. Will also attempt to connect
  10. // whenever possible and retries upon error with exponential backoff.
  11. class ConnectionScheduler {
  12. public:
  13. ConnectionScheduler(const ConnectionScheduler&) = delete;
  14. ConnectionScheduler& operator=(const ConnectionScheduler&) = delete;
  15. virtual ~ConnectionScheduler() = default;
  16. // Attempts a connection immediately, will be exponentially backed-off upon
  17. // failing to establish a connection.
  18. virtual void ScheduleConnectionNow() = 0;
  19. protected:
  20. ConnectionScheduler() = default;
  21. };
  22. } // namespace phonehub
  23. } // namespace ash
  24. #endif // ASH_COMPONENTS_PHONEHUB_CONNECTION_SCHEDULER_H_