Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: components/gcm_driver/gcm_delayed_task_controller.h

Issue 551163002: [GCM] Extracting Delayed Task Controller from GCMDesktopDriver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/gcm_driver/BUILD.gn ('k') | components/gcm_driver/gcm_delayed_task_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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
5 #ifndef COMPONENTS_GCM_DRIVER_GCM_DELAYED_TASK_CONTROLLER_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_DELAYED_TASK_CONTROLLER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11
12 namespace gcm {
13
14 // Helper class to save tasks to run until we're ready to execute them.
15 class GCMDelayedTaskController {
16 public:
17 GCMDelayedTaskController();
18 ~GCMDelayedTaskController();
19
20 // Adds a task that will be invoked once we're ready.
21 void AddTask(const base::Closure& task);
22
23 // Sets ready status, which will release all of the pending tasks.
24 void SetReady();
25
26 // Returns true if it is ready to perform tasks.
27 bool CanRunTaskWithoutDelay() const;
28
29 private:
30 void RunTasks();
31
32 // Flag that indicates that controlled component is ready.
33 bool ready_;
34
35 std::vector<base::Closure> delayed_tasks_;
36
37 DISALLOW_COPY_AND_ASSIGN(GCMDelayedTaskController);
38 };
39
40 } // namespace gcm
41
42 #endif // COMPONENTS_GCM_DRIVER_GCM_DELAYED_TASK_CONTROLLER_H_
OLDNEW
« no previous file with comments | « components/gcm_driver/BUILD.gn ('k') | components/gcm_driver/gcm_delayed_task_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698