| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "google_apis/drive/task_util.h" | 5 #include "google_apis/drive/task_util.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 | 8 |
| 9 namespace google_apis { | 9 namespace google_apis { |
| 10 | 10 |
| 11 void RunTaskOnThread(scoped_refptr<base::SequencedTaskRunner> task_runner, | 11 void RunTaskWithTaskRunner(scoped_refptr<base::TaskRunner> task_runner, |
| 12 const base::Closure& task) { | 12 const base::Closure& task) { |
| 13 if (task_runner->RunsTasksOnCurrentThread()) { | 13 const bool posted = task_runner->PostTask(FROM_HERE, task); |
| 14 task.Run(); | 14 DCHECK(posted); |
| 15 } else { | |
| 16 const bool posted = task_runner->PostTask(FROM_HERE, task); | |
| 17 DCHECK(posted); | |
| 18 } | |
| 19 } | 15 } |
| 20 | 16 |
| 21 } // namespace google_apis | 17 } // namespace google_apis |
| OLD | NEW |