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

Side by Side Diff: media/cdm/ppapi/cdm_file_io_impl.h

Issue 568623003: CdmAdapter: Report size of the file read by CDM via FileIO. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only report the first file read in CdmFileIOImpl (becase the completion cb can only be used once). Created 6 years, 3 months 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
« no previous file with comments | « media/cdm/ppapi/cdm_adapter.cc ('k') | media/cdm/ppapi/cdm_file_io_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // After the first successful file read, call |file_read_cb| to report the
39 // file size. |file_read_cb| takes one parameter: the file size in bytes.
40 CdmFileIOImpl(cdm::FileIOClient* client,
41 PP_Instance pp_instance,
42 const pp::CompletionCallback& file_read_cb);
ddorwin 2014/09/14 21:47:59 rename the cb here too?
xhwang 2014/09/15 03:44:31 Done.
39 43
40 // cdm::FileIO implementation. 44 // cdm::FileIO implementation.
41 virtual void Open(const char* file_name, uint32_t file_name_size) OVERRIDE; 45 virtual void Open(const char* file_name, uint32_t file_name_size) OVERRIDE;
42 virtual void Read() OVERRIDE; 46 virtual void Read() OVERRIDE;
43 virtual void Write(const uint8_t* data, uint32_t data_size) OVERRIDE; 47 virtual void Write(const uint8_t* data, uint32_t data_size) OVERRIDE;
44 virtual void Close() OVERRIDE; 48 virtual void Close() OVERRIDE;
45 49
46 private: 50 private:
47 enum State { 51 enum State {
48 FILE_UNOPENED, 52 FILE_UNOPENED,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 std::vector<char> io_buffer_; 155 std::vector<char> io_buffer_;
152 156
153 // Offset into the file for reading/writing data. When writing data to the 157 // Offset into the file for reading/writing data. When writing data to the
154 // file, this is also the offset to the |io_buffer_|. 158 // file, this is also the offset to the |io_buffer_|.
155 size_t io_offset_; 159 size_t io_offset_;
156 160
157 // Buffer to hold all read data requested. This buffer is passed to |client_| 161 // Buffer to hold all read data requested. This buffer is passed to |client_|
158 // when read completes. 162 // when read completes.
159 std::vector<char> cumulative_read_buffer_; 163 std::vector<char> cumulative_read_buffer_;
160 164
165 bool first_file_read_reported_;
166
167 // Callback to report the file size in bytes after the first successful read.
168 pp::CompletionCallback file_read_cb_;
169
161 DISALLOW_COPY_AND_ASSIGN(CdmFileIOImpl); 170 DISALLOW_COPY_AND_ASSIGN(CdmFileIOImpl);
162 }; 171 };
163 172
164 } // namespace media 173 } // namespace media
165 174
166 #endif // MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_ 175 #endif // MEDIA_CDM_PPAPI_CDM_FILE_IO_IMPL_H_
OLDNEW
« no previous file with comments | « media/cdm/ppapi/cdm_adapter.cc ('k') | media/cdm/ppapi/cdm_file_io_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698