OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 105 |
106 FileError::ErrorCode GetErrorCode() const { return error_code_; } | 106 FileError::ErrorCode GetErrorCode() const { return error_code_; } |
107 | 107 |
108 void SetEncoding(const String&); | 108 void SetEncoding(const String&); |
109 void SetDataType(const String& data_type) { data_type_ = data_type; } | 109 void SetDataType(const String& data_type) { data_type_ = data_type; } |
110 | 110 |
111 private: | 111 private: |
112 FileReaderLoader(ReadType, FileReaderLoaderClient*); | 112 FileReaderLoader(ReadType, FileReaderLoaderClient*); |
113 | 113 |
114 void Cleanup(); | 114 void Cleanup(); |
115 void ReportAdditionalMemoryUsageToV8(int64_t usage); | |
116 void UnreportMemoryUsageToV8(); | |
115 | 117 |
116 void Failed(FileError::ErrorCode); | 118 void Failed(FileError::ErrorCode); |
117 void ConvertToText(); | 119 String ConvertToText(); |
118 void ConvertToDataURL(); | 120 String ConvertToDataURL(); |
121 void SetStringResult(const String&); | |
119 | 122 |
120 static FileError::ErrorCode HttpStatusCodeToErrorCode(int); | 123 static FileError::ErrorCode HttpStatusCodeToErrorCode(int); |
121 | 124 |
122 ReadType read_type_; | 125 ReadType read_type_; |
123 FileReaderLoaderClient* client_; | 126 FileReaderLoaderClient* client_; |
124 WTF::TextEncoding encoding_; | 127 WTF::TextEncoding encoding_; |
125 String data_type_; | 128 String data_type_; |
126 | 129 |
127 KURL url_for_reading_; | 130 KURL url_for_reading_; |
128 Persistent<ThreadableLoader> loader_; | 131 Persistent<ThreadableLoader> loader_; |
129 | 132 |
130 std::unique_ptr<ArrayBufferBuilder> raw_data_; | 133 std::unique_ptr<ArrayBufferBuilder> raw_data_; |
131 bool is_raw_data_converted_; | 134 bool is_raw_data_converted_; |
132 | 135 |
133 Persistent<DOMArrayBuffer> array_buffer_result_; | 136 Persistent<DOMArrayBuffer> array_buffer_result_; |
134 String string_result_; | 137 String string_result_; |
135 | 138 |
136 // The decoder used to decode the text data. | 139 // The decoder used to decode the text data. |
137 std::unique_ptr<TextResourceDecoder> decoder_; | 140 std::unique_ptr<TextResourceDecoder> decoder_; |
138 | 141 |
139 bool finished_loading_; | 142 bool finished_loading_; |
140 long long bytes_loaded_; | 143 long long bytes_loaded_; |
141 // If the total size of the resource is unknown, m_totalBytes is set to -1 | 144 // If the total size of the resource is unknown, m_totalBytes is set to -1 |
142 // until completion of loading, and the buffer for receiving data is set to | 145 // until completion of loading, and the buffer for receiving data is set to |
143 // dynamically grow. Otherwise, m_totalBytes is set to the total size and | 146 // dynamically grow. Otherwise, m_totalBytes is set to the total size and |
144 // the buffer for receiving data of m_totalBytes is allocated and never grow | 147 // the buffer for receiving data of m_totalBytes is allocated and never grow |
145 // even when extra data is appeneded. | 148 // even when extra data is appeneded. |
146 long long total_bytes_; | 149 long long total_bytes_; |
147 | 150 int64_t memory_usage_reported_to_v8_ = 0; |
michaeln
2017/04/28 00:54:25
i can switch more of the data members to initializ
dmurph
2017/04/28 20:39:44
That would be great actually. I like that style.
| |
148 bool has_range_; | 151 bool has_range_; |
149 unsigned range_start_; | 152 unsigned range_start_; |
150 unsigned range_end_; | 153 unsigned range_end_; |
151 | 154 |
152 FileError::ErrorCode error_code_; | 155 FileError::ErrorCode error_code_; |
153 }; | 156 }; |
154 | 157 |
155 } // namespace blink | 158 } // namespace blink |
156 | 159 |
157 #endif // FileReaderLoader_h | 160 #endif // FileReaderLoader_h |
OLD | NEW |