OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_ | 5 #ifndef MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_ |
6 #define MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_ | 6 #define MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... | |
28 // There should be only one instance of ResourceTracker in a process. Also, | 28 // There should be only one instance of ResourceTracker in a process. Also, |
29 // ResourceTracker should outlive all CdmFileIOImpl instances. | 29 // ResourceTracker should outlive all CdmFileIOImpl instances. |
30 class ResourceTracker { | 30 class ResourceTracker { |
31 public: | 31 public: |
32 ResourceTracker(); | 32 ResourceTracker(); |
33 ~ResourceTracker(); | 33 ~ResourceTracker(); |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); | 35 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); |
36 }; | 36 }; |
37 | 37 |
38 CdmFileIOImpl(cdm::FileIOClient* client, PP_Instance pp_instance); | 38 CdmFileIOImpl(cdm::FileIOClient* client, |
39 PP_Instance pp_instance, | |
40 const pp::CompletionCallback& file_read_cb); | |
ddorwin
2014/09/12 05:44:29
Comment that the CB takes a parameter that is the
xhwang
2014/09/12 17:48:45
Done.
| |
39 | 41 |
40 // cdm::FileIO implementation. | 42 // cdm::FileIO implementation. |
41 virtual void Open(const char* file_name, uint32_t file_name_size) OVERRIDE; | 43 virtual void Open(const char* file_name, uint32_t file_name_size) OVERRIDE; |
42 virtual void Read() OVERRIDE; | 44 virtual void Read() OVERRIDE; |
43 virtual void Write(const uint8_t* data, uint32_t data_size) OVERRIDE; | 45 virtual void Write(const uint8_t* data, uint32_t data_size) OVERRIDE; |
44 virtual void Close() OVERRIDE; | 46 virtual void Close() OVERRIDE; |
45 | 47 |
46 private: | 48 private: |
47 enum State { | 49 enum State { |
48 FILE_UNOPENED = 0, | 50 FILE_UNOPENED = 0, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 std::vector<char> io_buffer_; | 157 std::vector<char> io_buffer_; |
156 | 158 |
157 // Offset into the file for reading/writing data. When writing data to the | 159 // Offset into the file for reading/writing data. When writing data to the |
158 // file, this is also the offset to the |io_buffer_|. | 160 // file, this is also the offset to the |io_buffer_|. |
159 size_t io_offset_; | 161 size_t io_offset_; |
160 | 162 |
161 // Buffer to hold all read data requested. This buffer is passed to |client_| | 163 // Buffer to hold all read data requested. This buffer is passed to |client_| |
162 // when read completes. | 164 // when read completes. |
163 std::vector<char> cumulative_read_buffer_; | 165 std::vector<char> cumulative_read_buffer_; |
164 | 166 |
167 // Callback to report the size of the file after a succeessful read. | |
168 pp::CompletionCallback file_read_cb_; | |
169 | |
165 DISALLOW_COPY_AND_ASSIGN(CdmFileIOImpl); | 170 DISALLOW_COPY_AND_ASSIGN(CdmFileIOImpl); |
166 }; | 171 }; |
167 | 172 |
168 } // namespace media | 173 } // namespace media |
169 | 174 |
170 #endif // MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_ | 175 #endif // MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_ |
OLD | NEW |