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

Unified Diff: chrome/browser/chromeos/gdata/task_util.cc

Issue 10825459: gdata: Move task related functions like RunTaskOnUIThread from gdata_file_system.cc to task_util.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/gdata/task_util.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/task_util.cc
diff --git a/chrome/browser/chromeos/gdata/task_util.cc b/chrome/browser/chromeos/gdata/task_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..77c4b46d2360921b1563a23d993ed73637d07585
--- /dev/null
+++ b/chrome/browser/chromeos/gdata/task_util.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 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.
+
+#include "chrome/browser/chromeos/gdata/task_util.h"
+
+#include "base/location.h"
+#include "content/public/browser/browser_thread.h"
+
+using content::BrowserThread;
+
+namespace gdata {
+
+void RunTaskOnThread(scoped_refptr<base::MessageLoopProxy> relay_proxy,
+ const base::Closure& task) {
+ if (relay_proxy->BelongsToCurrentThread()) {
+ task.Run();
+ } else {
+ const bool posted = relay_proxy->PostTask(FROM_HERE, task);
+ DCHECK(posted);
+ }
+}
+
+void RunTaskOnUIThread(const base::Closure& task) {
+ RunTaskOnThread(
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), task);
+}
+
+} // namespace gdata
« no previous file with comments | « chrome/browser/chromeos/gdata/task_util.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698