Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #ifndef CAST_BASE_CAST_RESOURCE_H_ | |
|
gunsch
2015/09/01 22:56:08
nit: blank line above
yucliu1
2015/09/01 23:42:13
Done.
| |
| 5 #define CAST_BASE_CAST_RESOURCE_H_ | |
|
halliwell
2015/09/01 19:42:23
nit: this doesn't match path.
gunsch
2015/09/01 22:56:08
nit: move this back to chromecast/base/ :)
yucliu1
2015/09/01 23:42:13
Done.
| |
| 6 | |
| 7 namespace cast { | |
|
halliwell
2015/09/01 19:42:23
nit: really should be an outer namespace chromecas
yucliu1
2015/09/01 20:15:47
If this is supposed in cast/, we'd better keep con
gunsch
2015/09/01 22:56:08
per offline, namespace is chromecast
yucliu1
2015/09/01 23:42:13
Done.
| |
| 8 | |
| 9 // Interface for resources needed to run application. | |
| 10 class CastResource { | |
|
halliwell
2015/09/01 19:42:24
nit: do we need it to be called CastResource if it
| |
| 11 public: | |
| 12 // Resources necessary to run cast apps. | |
| 13 enum Resource { | |
|
gunsch
2015/09/01 22:56:08
optional naming q: if the class is Resource, shoul
yucliu1
2015/09/01 23:42:13
I think it's better to use Resource since it's a u
| |
| 14 kResourceNone = 0, | |
| 15 // All resources necessary to render sounds, for example, audio pipeline, | |
| 16 // speaker, etc. | |
| 17 kResourceAudio = 1 << 0, | |
|
halliwell
2015/09/01 19:42:23
what is audio for and where is it used? I'm not c
yucliu1
2015/09/01 20:15:47
internal code will use it.
halliwell
2015/09/01 20:24:39
I don't believe it does anything useful with it, b
| |
| 18 // All resources necessary to render videos or images, for example, video | |
| 19 // pipeline, primary graphics plane, display, etc. | |
|
halliwell
2015/09/01 19:42:23
see comment elsewhere, I think we need to separate
yucliu1
2015/09/01 20:15:47
Single CastResource can hold multiple resources an
halliwell
2015/09/01 20:24:39
That seems ... useless. The whole point of the re
yucliu1
2015/09/01 20:36:42
Wait, should MediaPipeline use both audio and vide
| |
| 20 kResourceScreenPrimary = 1 << 1, | |
| 21 // All resources necessary to render overlaid images, for example, secondary | |
| 22 // graphics plane, LCD, etc. | |
| 23 kResourceScreenSecondary = 1 << 2, | |
| 24 // Collection of resources used for display only combined with bitwise or. | |
| 25 kResourceDisplayOnly = (kResourceScreenPrimary | kResourceScreenSecondary), | |
| 26 // Collection of all resources combined with bitwise or. | |
| 27 kResourceAll = | |
| 28 (kResourceAudio | kResourceScreenPrimary | kResourceScreenSecondary), | |
| 29 }; | |
| 30 | |
| 31 class Client { | |
| 32 public: | |
| 33 virtual void OnResourceAcquired(CastResource* cast_resource) = 0; | |
| 34 virtual void OnResourceReleased(CastResource* cast_resource, | |
| 35 Resource resource) = 0; | |
|
gunsch
2015/09/01 23:04:15
I just noticed in the internal CL that "resource"
| |
| 36 | |
| 37 protected: | |
| 38 virtual ~Client() {} | |
| 39 }; | |
| 40 | |
| 41 // Called to release resources. Implementation should call | |
| 42 // Client::OnResourceReleased when resource is released on its side. | |
| 43 virtual void ReleaseResource(Resource resource) = 0; | |
| 44 virtual void SetCastResourceClient(Client* client) = 0; | |
|
gunsch
2015/09/01 22:56:08
nit: can we put this first, to represent the gener
| |
| 45 | |
| 46 protected: | |
| 47 virtual ~CastResource() {} | |
|
gunsch
2015/09/01 22:56:08
why is this protected? Doesn't this limit CastReso
yucliu1
2015/09/01 23:42:13
With current implementation, CastResource is owned
gunsch
2015/09/02 17:10:50
Agreed, but I think this means that an owner can't
yucliu1
2015/09/02 17:30:18
The owner should know the type of CastResource. If
| |
| 48 }; | |
|
gunsch
2015/09/01 22:56:08
DISALLOW_COPY_AND_ASSIGN(CastResource);
plus #inc
| |
| 49 | |
| 50 } // namespace cast | |
| 51 | |
| 52 #endif | |
| OLD | NEW |