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.
5 #include "components/gcm_driver/gcm_delayed_task_controller.h"
7 #include "base/logging.h"
11 GCMDelayedTaskController::GCMDelayedTaskController() : ready_(false) {
14 GCMDelayedTaskController::~GCMDelayedTaskController() {
17 void GCMDelayedTaskController::AddTask(const base::Closure
& task
) {
18 delayed_tasks_
.push_back(task
);
21 void GCMDelayedTaskController::SetReady() {
26 bool GCMDelayedTaskController::CanRunTaskWithoutDelay() const {
30 void GCMDelayedTaskController::RunTasks() {
33 for (size_t i
= 0; i
< delayed_tasks_
.size(); ++i
)
34 delayed_tasks_
[i
].Run();
35 delayed_tasks_
.clear();