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

Side by Side Diff: chromecast/base/cast_resource.h

Issue 1531543002: [Chromecast] Adding pause/resume operations to VideoPlaneController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just modified a comment back the way it was. Created 5 years 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMECAST_BASE_CAST_RESOURCE_H_ 5 #ifndef CHROMECAST_BASE_CAST_RESOURCE_H_
6 #define CHROMECAST_BASE_CAST_RESOURCE_H_ 6 #define CHROMECAST_BASE_CAST_RESOURCE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 9
10 namespace chromecast { 10 namespace chromecast {
11 11
12 // Interface for resources needed to run application. 12 // Interface for resources needed to run application.
13 class CastResource { 13 class CastResource {
byungchul 2015/12/18 00:53:21 Can we rename this as CastResourceContainer or som
esum 2015/12/21 00:39:21 Agreed. Doing later in another CL though since the
14 public: 14 public:
15 // Resources necessary to run cast apps. CastResource may contain union of the 15 // Resources necessary to run cast apps. CastResource may contain union of the
16 // following types. 16 // following types.
17 // TODO(yucliu): Split video resources and graphic resources. 17 // TODO(yucliu): Split video resources and graphic resources.
18 enum Resource { 18 enum Resource {
19 kResourceNone = 0, 19 kResourceNone = 0,
20 // All resources necessary to render sounds, for example, audio pipeline, 20 // All resources necessary to render sounds, for example, audio pipeline,
21 // speaker, etc. 21 // speaker, etc.
22 kResourceAudio = 1 << 0, 22 kResourceAudio = 1 << 0,
23 // All resources necessary to render videos or images, for example, video 23 // All resources necessary to render videos or images, for example, video
(...skipping 22 matching lines...) Expand all
46 // returned, Client will remove the resource from its watching 46 // returned, Client will remove the resource from its watching
47 // list. 47 // list.
48 virtual void OnResourceReleased(CastResource* cast_resource, 48 virtual void OnResourceReleased(CastResource* cast_resource,
49 Resource remain) = 0; 49 Resource remain) = 0;
50 50
51 protected: 51 protected:
52 virtual ~Client() {} 52 virtual ~Client() {}
53 }; 53 };
54 54
55 void SetCastResourceClient(Client* client); 55 void SetCastResourceClient(Client* client);
56 // Called to initialize resources after OEM has granted them, and before
57 // they start getting used by consumers. Implementation must be synchronous
58 // since consumers will start using the resource immediately afterwards.
59 // TODO(esum): We should allow this method to be asynchronous in case an
60 // implementer needs to make expensive calls and doesn't want to block the
61 // UI thread (b/26239576). For now, don't do anything expensive in your
62 // implementation; if you really need to, then this bug has to be resolved.
63 virtual void InitializeResource(Resource resource) = 0;
byungchul 2015/12/18 00:53:21 GrantResource?
esum 2015/12/21 00:39:21 I actually prefer InitializeResource since this se
derekjchow1 2016/01/04 17:29:10 How about AcquireResource, since this is the oppos
esum 2016/01/11 16:28:57 Done. Had to rearrange some names to make things c
56 // Called to release resources. Implementation should call 64 // Called to release resources. Implementation should call
57 // Client::OnResourceReleased when resource is released on its side. 65 // Client::OnResourceReleased when resource is released on its side.
58 virtual void ReleaseResource(Resource resource) = 0; 66 virtual void ReleaseResource(Resource resource) = 0;
59 67
60 protected: 68 protected:
61 CastResource() : client_(nullptr) {} 69 CastResource() : client_(nullptr) {}
62 virtual ~CastResource() {} 70 virtual ~CastResource() {}
63 71
64 void NotifyResourceAcquired(); 72 void NotifyResourceAcquired();
65 void NotifyResourceReleased(Resource remain); 73 void NotifyResourceReleased(Resource remain);
66 74
67 private: 75 private:
68 Client* client_; 76 Client* client_;
69 77
70 DISALLOW_COPY_AND_ASSIGN(CastResource); 78 DISALLOW_COPY_AND_ASSIGN(CastResource);
71 }; 79 };
72 80
73 } // namespace chromecast 81 } // namespace chromecast
74 82
75 #endif 83 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698