1 // Copyright 2015 The Weave 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 5 #ifndef LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TASK_RUNNER_H_ 6 #define LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TASK_RUNNER_H_ 7 8 #include <string> 9 #include <utility> 10 #include <vector> 11 12 #include <base/callback.h> 13 #include <base/location.h> 14 #include <base/time/time.h> 15 16 namespace weave { 17 namespace provider { 18 19 // Interface with methods to post tasks into platform-specific message loop of 20 // the current thread. 21 class TaskRunner { 22 public: 23 // Posts tasks to be executed with the given delay. 24 // |from_here| argument is used for debugging and usually just provided by 25 // FROM_HERE macro. Implementation may ignore this argument. 26 virtual void PostDelayedTask(const tracked_objects::Location& from_here, 27 const base::Closure& task, 28 base::TimeDelta delay) = 0; 29 30 protected: ~TaskRunner()31 virtual ~TaskRunner() {} 32 }; 33 34 } // namespace provider 35 } // namespace weave 36 37 #endif // LIBWEAVE_INCLUDE_WEAVE_PROVIDER_TASK_RUNNER_H_ 38