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

Unified Diff: chromecast/media/cma/base/media_task_runner.h

Issue 534893002: Introduce the concept of media task runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comments from patch set #1. Created 6 years, 3 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/media/cma/base/media_task_runner.h
diff --git a/chromecast/media/cma/base/media_task_runner.h b/chromecast/media/cma/base/media_task_runner.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4a3012c941c021a27fb409169c64105fc351bc1
--- /dev/null
+++ b/chromecast/media/cma/base/media_task_runner.h
@@ -0,0 +1,44 @@
+// Copyright 2014 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_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_
+#define CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_
+
+#include "base/callback.h"
+#include "base/location.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/time/time.h"
+
+namespace chromecast {
+namespace media {
+
+class MediaTaskRunner
+ : public base::RefCountedThreadSafe<MediaTaskRunner> {
+ public:
+ MediaTaskRunner();
+
+ // Post a task with the given media |timestamp|. If |timestamp| is equal to
+ // |kNoTimestamp()|, the task is scheduled right away.
+ // How the media timestamp is used to schedule the task is an implementation
+ // detail of derived classes.
+ // Returns true if the task may be run at some point in the future, and false
+ // if the task definitely will not be run.
+ virtual bool PostMediaTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta timestamp) = 0;
+
+ protected:
+ virtual ~MediaTaskRunner();
+ friend class base::RefCountedThreadSafe<MediaTaskRunner>;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MediaTaskRunner);
+};
+
+} // namespace media
+} // namespace chromecast
+
+#endif // CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_

Powered by Google App Engine
This is Rietveld 408576698