OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/gdata/task_util.h" |
| 6 |
| 7 #include "base/location.h" |
| 8 #include "content/public/browser/browser_thread.h" |
| 9 |
| 10 using content::BrowserThread; |
| 11 |
| 12 namespace gdata { |
| 13 |
| 14 void RunTaskOnThread(scoped_refptr<base::MessageLoopProxy> relay_proxy, |
| 15 const base::Closure& task) { |
| 16 if (relay_proxy->BelongsToCurrentThread()) { |
| 17 task.Run(); |
| 18 } else { |
| 19 const bool posted = relay_proxy->PostTask(FROM_HERE, task); |
| 20 DCHECK(posted); |
| 21 } |
| 22 } |
| 23 |
| 24 void RunTaskOnUIThread(const base::Closure& task) { |
| 25 RunTaskOnThread( |
| 26 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), task); |
| 27 } |
| 28 |
| 29 } // namespace gdata |
OLD | NEW |