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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chromecast/browser/cast_content_browser_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CHROMECAST_BASE_CAST_RESOURCE_H_
6 #define CHROMECAST_BASE_CAST_RESOURCE_H_
7
8 #include "base/macros.h"
9
10 namespace chromecast {
11
12 // Interface for resources needed to run application.
13 class CastResource {
14 public:
15 // Resources necessary to run cast apps. CastResource may contain union of the
16 // following types.
17 // TODO(yucliu): Split video resources and graphic resources.
18 enum Resource {
19 kResourceNone = 0,
20 // All resources necessary to render sounds, for example, audio pipeline,
21 // speaker, etc.
22 kResourceAudio = 1 << 0,
23 // All resources necessary to render videos or images, for example, video
24 // pipeline, primary graphics plane, display, etc.
25 kResourceScreenPrimary = 1 << 1,
26 // All resources necessary to render overlaid images, for example, secondary
27 // graphics plane, LCD, etc.
28 kResourceScreenSecondary = 1 << 2,
29 // Collection of resources used for display only combined with bitwise or.
30 kResourceDisplayOnly = (kResourceScreenPrimary | kResourceScreenSecondary),
31 // Collection of all resources combined with bitwise or.
32 kResourceAll =
33 (kResourceAudio | kResourceScreenPrimary | kResourceScreenSecondary),
34 };
35
36 class Client {
37 public:
38 // Called when resource is created. CastResource should not be owned by
39 // Client. It can be called from any thread.
40 virtual void OnResourceAcquired(CastResource* cast_resource) = 0;
41 // Called when part or all resources are released. It can be called from any
42 // thread.
43 // |cast_resource| the CastResource that is released. The pointer may be
44 // invalid. Client can't call functions with that pointer.
45 // |remain| the unreleased resource of CastResource. If kResourceNone is
46 // returned, Client will remove the resource from its watching
47 // list.
48 virtual void OnResourceReleased(CastResource* cast_resource,
49 Resource remain) = 0;
50
51 protected:
52 virtual ~Client() {}
53 };
54
55 CastResource() {}
56
57 virtual void SetCastResourceClient(Client* client) = 0;
58 // Called to release resources. Implementation should call
59 // Client::OnResourceReleased when resource is released on its side.
60 virtual void ReleaseResource(Resource resource) = 0;
61
62 protected:
63 virtual ~CastResource() {}
64
65 private:
66 DISALLOW_COPY_AND_ASSIGN(CastResource);
67 };
68
69 } // namespace chromecast
70
71 #endif
OLDNEW
« 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