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

Unified Diff: chromecast/public/task_runner.h

Issue 1105803002: Exposes a shlib interface for media/audio path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment out streaming test until the default implementation is improved. Created 5 years, 5 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
Index: chromecast/public/task_runner.h
diff --git a/chromecast/public/task_runner.h b/chromecast/public/task_runner.h
new file mode 100644
index 0000000000000000000000000000000000000000..4e1a3e09520a9332cb8492f2931e4b6cb6782c7e
--- /dev/null
+++ b/chromecast/public/task_runner.h
@@ -0,0 +1,33 @@
+// Copyright 2015 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.
+
+#ifndef CHROMECAST_PUBLIC_TASK_RUNNER_H_
+#define CHROMECAST_PUBLIC_TASK_RUNNER_H_
+
+#include <stdint.h>
+
+namespace chromecast {
+
+// Provides a way for vendor libraries to run code on a specific thread.
+// For example, used in media APIs to allow code to be run on the media thread.
+class TaskRunner {
+ public:
+ // Subclass and implement 'Run' to supply code to be run by PostTask or
+ // PostDelayedTask. They both take ownership of the Task object passed in
+ // and will delete after running the Task.
+ class Task {
+ public:
+ virtual ~Task() {}
+ virtual void Run() = 0;
+ };
+
+ virtual ~TaskRunner() {}
+
+ virtual bool BelongsToCurrentThread() = 0;
+ virtual bool PostTask(Task* task, uint64_t delay_milliseconds) = 0;
+};
+
+} // namespace chromecast
+
+#endif // CHROMECAST_PUBLIC_TASK_RUNNER_H_

Powered by Google App Engine
This is Rietveld 408576698