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

Side by Side Diff: ui/ozone/platform/drm/gpu/proxy_helpers.h

Issue 1311043016: Switch DRM platform to using a separate thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread2
Patch Set: . Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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 #ifndef UI_OZONE_PLATFORM_DRM_GPU_PROXY_HELPERS_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_PROXY_HELPERS_H_
7
8 #include "base/bind.h"
9 #include "base/location.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/thread_task_runner_handle.h"
12
13 namespace ui {
14
15 namespace internal {
16
17 template <typename... Args>
18 void PostAsyncTask(
19 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
20 const base::Callback<void(Args...)>& callback,
21 Args... args) {
22 task_runner->PostTask(FROM_HERE, base::Bind(callback, args...));
23 }
24
25 } // namespace internal
26
27 // Posts a task to a different thread and blocks waiting for the task to finish
28 // executing.
29 void PostSyncTask(
30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
31 const base::Closure& callback);
32
33 // Creates a callback that will run |callback| on the calling thread. Useful
34 // when posting a task on a different thread and expecting a callback when the
35 // task finished (and the callback needs to run on the original thread).
36 template <typename... Args>
37 base::Callback<void(Args...)> CreateSafeCallback(
38 const base::Callback<void(Args...)>& callback) {
39 return base::Bind(&internal::PostAsyncTask<Args...>,
40 base::ThreadTaskRunnerHandle::Get(), callback);
41 }
42
43 } // namespace ui
44
45 #endif // UI_OZONE_PLATFORM_DRM_GPU_PROXY_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698