Home | History | Annotate | Download | only in google_apis
      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/google_apis/task_util.h"
      6 
      7 #include "base/location.h"
      8 
      9 namespace google_apis {
     10 
     11 void RunTaskOnThread(scoped_refptr<base::MessageLoopProxy> relay_proxy,
     12                      const base::Closure& task) {
     13   if (relay_proxy->BelongsToCurrentThread()) {
     14     task.Run();
     15   } else {
     16     const bool posted = relay_proxy->PostTask(FROM_HERE, task);
     17     DCHECK(posted);
     18   }
     19 }
     20 
     21 }  // namespace google_apis
     22