Chromium Code Reviews| Index: chromecast/cast/cast_resource.h |
| diff --git a/chromecast/cast/cast_resource.h b/chromecast/cast/cast_resource.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..598b94341cc4e2fc4b3168eb8119b0654e4318d7 |
| --- /dev/null |
| +++ b/chromecast/cast/cast_resource.h |
| @@ -0,0 +1,52 @@ |
| +// 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 CAST_BASE_CAST_RESOURCE_H_ |
|
gunsch
2015/09/01 22:56:08
nit: blank line above
yucliu1
2015/09/01 23:42:13
Done.
|
| +#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.
|
| + |
| +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.
|
| + |
| +// Interface for resources needed to run application. |
| +class CastResource { |
|
halliwell
2015/09/01 19:42:24
nit: do we need it to be called CastResource if it
|
| + public: |
| + // Resources necessary to run cast apps. |
| + 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
|
| + kResourceNone = 0, |
| + // All resources necessary to render sounds, for example, audio pipeline, |
| + // speaker, etc. |
| + 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
|
| + // All resources necessary to render videos or images, for example, video |
| + // 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
|
| + 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: |
| + virtual void OnResourceAcquired(CastResource* cast_resource) = 0; |
| + virtual void OnResourceReleased(CastResource* cast_resource, |
| + Resource resource) = 0; |
|
gunsch
2015/09/01 23:04:15
I just noticed in the internal CL that "resource"
|
| + |
| + protected: |
| + virtual ~Client() {} |
| + }; |
| + |
| + // Called to release resources. Implementation should call |
| + // Client::OnResourceReleased when resource is released on its side. |
| + virtual void ReleaseResource(Resource resource) = 0; |
| + virtual void SetCastResourceClient(Client* client) = 0; |
|
gunsch
2015/09/01 22:56:08
nit: can we put this first, to represent the gener
|
| + |
| + protected: |
| + 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
|
| +}; |
|
gunsch
2015/09/01 22:56:08
DISALLOW_COPY_AND_ASSIGN(CastResource);
plus #inc
|
| + |
| +} // namespace cast |
| + |
| +#endif |