| OLD | NEW |
| 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 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual void InitializeResource(Resource resource) = 0; |
| 56 // Called to release resources. Implementation should call | 60 // Called to release resources. Implementation should call |
| 57 // Client::OnResourceReleased when resource is released on its side. | 61 // Client::OnResourceReleased when resource is released on its side. |
| 58 virtual void ReleaseResource(Resource resource) = 0; | 62 virtual void ReleaseResource(Resource resource) = 0; |
| 59 | 63 |
| 60 protected: | 64 protected: |
| 61 CastResource() : client_(nullptr) {} | 65 CastResource() : client_(nullptr) {} |
| 62 virtual ~CastResource() {} | 66 virtual ~CastResource() {} |
| 63 | 67 |
| 64 void NotifyResourceAcquired(); | 68 void NotifyResourceAcquired(); |
| 65 void NotifyResourceReleased(Resource remain); | 69 void NotifyResourceReleased(Resource remain); |
| 66 | 70 |
| 67 private: | 71 private: |
| 68 Client* client_; | 72 Client* client_; |
| 69 | 73 |
| 70 DISALLOW_COPY_AND_ASSIGN(CastResource); | 74 DISALLOW_COPY_AND_ASSIGN(CastResource); |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 } // namespace chromecast | 77 } // namespace chromecast |
| 74 | 78 |
| 75 #endif | 79 #endif |
| OLD | NEW |