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

Unified Diff: chromecast/base/cast_resource.h

Issue 1306843003: CmaMediaPipelineClient to watch media pipeline status (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Doc Created 5 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
« no previous file with comments | « no previous file | chromecast/browser/cast_content_browser_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/base/cast_resource.h
diff --git a/chromecast/base/cast_resource.h b/chromecast/base/cast_resource.h
new file mode 100644
index 0000000000000000000000000000000000000000..8836e9c7c1783609ee10b20046763d2733b8ae20
--- /dev/null
+++ b/chromecast/base/cast_resource.h
@@ -0,0 +1,71 @@
+// 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_BASE_CAST_RESOURCE_H_
+#define CHROMECAST_BASE_CAST_RESOURCE_H_
+
+#include "base/macros.h"
+
+namespace chromecast {
+
+// Interface for resources needed to run application.
+class CastResource {
+ public:
+ // Resources necessary to run cast apps. CastResource may contain union of the
+ // following types.
+ // TODO(yucliu): Split video resources and graphic resources.
+ enum Resource {
+ kResourceNone = 0,
+ // All resources necessary to render sounds, for example, audio pipeline,
+ // speaker, etc.
+ kResourceAudio = 1 << 0,
+ // All resources necessary to render videos or images, for example, video
+ // pipeline, primary graphics plane, display, etc.
+ kResourceScreenPrimary = 1 << 1,
+ // All resources necessary to render overlaid images, for example, secondary
+ // graphics plane, LCD, etc.
+ kResourceScreenSecondary = 1 << 2,
+ // Collection of resources used for display only combined with bitwise or.
+ kResourceDisplayOnly = (kResourceScreenPrimary | kResourceScreenSecondary),
+ // Collection of all resources combined with bitwise or.
+ kResourceAll =
+ (kResourceAudio | kResourceScreenPrimary | kResourceScreenSecondary),
+ };
+
+ class Client {
+ public:
+ // Called when resource is created. CastResource should not be owned by
+ // Client. It can be called from any thread.
+ virtual void OnResourceAcquired(CastResource* cast_resource) = 0;
+ // Called when part or all resources are released. It can be called from any
+ // thread.
+ // |cast_resource| the CastResource that is released. The pointer may be
+ // invalid. Client can't call functions with that pointer.
+ // |remain| the unreleased resource of CastResource. If kResourceNone is
+ // returned, Client will remove the resource from its watching
+ // list.
+ virtual void OnResourceReleased(CastResource* cast_resource,
+ Resource remain) = 0;
+
+ protected:
+ virtual ~Client() {}
+ };
+
+ CastResource() {}
+
+ virtual void SetCastResourceClient(Client* client) = 0;
+ // Called to release resources. Implementation should call
+ // Client::OnResourceReleased when resource is released on its side.
+ virtual void ReleaseResource(Resource resource) = 0;
+
+ protected:
+ virtual ~CastResource() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CastResource);
+};
+
+} // namespace chromecast
+
+#endif
« no previous file with comments | « no previous file | chromecast/browser/cast_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698