diff options
author | sorin <sorin@chromium.org> | 2015-05-26 12:59:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-26 20:00:01 +0000 |
commit | 7c7176234e553c35a2d8ec014f2caa29f7278065 (patch) | |
tree | 70eb3c58c82369cc13c939c17ae63344644c4b31 /components/component_updater/timer.h | |
parent | 92780e77b6e0755e1d4bacbd493032969d04293b (diff) | |
download | chromium_src-7c7176234e553c35a2d8ec014f2caa29f7278065.zip chromium_src-7c7176234e553c35a2d8ec014f2caa29f7278065.tar.gz chromium_src-7c7176234e553c35a2d8ec014f2caa29f7278065.tar.bz2 |
Rewrite component update service in terms of components/update_client.
The goal of this change is to re-implement the component updater by
reusing the common code in components/update_client while keeping
the its public interface the same as before, in order to minimize
changes in its existing clients.
BUG=450337
Review URL: https://codereview.chromium.org/1133443002
Cr-Commit-Position: refs/heads/master@{#331412}
Diffstat (limited to 'components/component_updater/timer.h')
-rw-r--r-- | components/component_updater/timer.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/components/component_updater/timer.h b/components/component_updater/timer.h new file mode 100644 index 0000000..8b72899 --- /dev/null +++ b/components/component_updater/timer.h @@ -0,0 +1,42 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_COMPONENT_UPDATER_TIMER_H_ +#define COMPONENTS_COMPONENT_UPDATER_TIMER_H_ + +#include "base/callback.h" +#include "base/macros.h" +#include "base/threading/thread_checker.h" +#include "base/time/time.h" +#include "base/timer/timer.h" + +namespace component_updater { + +class Timer { + public: + Timer(); + ~Timer(); + + void Start(base::TimeDelta initial_delay, + base::TimeDelta delay, + const base::Closure& user_task); + + void Stop(); + + private: + void OnDelay(); + + base::ThreadChecker thread_checker_; + + base::Timer timer_; + + base::TimeDelta delay_; + base::Closure user_task_; + + DISALLOW_COPY_AND_ASSIGN(Timer); +}; + +} // namespace component_updater + +#endif // COMPONENTS_COMPONENT_UPDATER_TIMER_H_ |