| 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 CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 5 #ifndef CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
| 6 #define CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 6 #define CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
| 7 | 7 |
| 8 #include <dwrite.h> | 8 #include <dwrite.h> |
| 9 #include <wrl.h> | 9 #include <wrl.h> |
| 10 | 10 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 std::vector<Microsoft::WRL::ComPtr<IDWriteFontFileStream>> file_streams_; | 173 std::vector<Microsoft::WRL::ComPtr<IDWriteFontFileStream>> file_streams_; |
| 174 UINT32 next_file_ = 0; | 174 UINT32 next_file_ = 0; |
| 175 UINT32 current_file_ = UINT_MAX; | 175 UINT32 current_file_ = UINT_MAX; |
| 176 | 176 |
| 177 DISALLOW_ASSIGN(FontFileEnumerator); | 177 DISALLOW_ASSIGN(FontFileEnumerator); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 // Implements the DirectWrite font file stream interface that maps the file to | 180 // Implements the DirectWrite font file stream interface that maps the file to |
| 181 // be loaded as a memory mapped file, and subsequently returns pointers into | 181 // be loaded as a memory mapped file, and subsequently returns pointers into |
| 182 // the mapped memory block. | 182 // the mapped memory block. |
| 183 // TODO(kulshin): confirm that using custom streams is actually an improvement | |
| 184 class CONTENT_EXPORT FontFileStream | 183 class CONTENT_EXPORT FontFileStream |
| 185 : public Microsoft::WRL::RuntimeClass< | 184 : public Microsoft::WRL::RuntimeClass< |
| 186 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, | 185 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, |
| 187 IDWriteFontFileStream> { | 186 IDWriteFontFileStream> { |
| 188 public: | 187 public: |
| 189 FontFileStream(); | 188 FontFileStream(); |
| 190 ~FontFileStream() override; | 189 ~FontFileStream() override; |
| 191 | 190 |
| 192 // IDWriteFontFileStream: | 191 // IDWriteFontFileStream: |
| 193 HRESULT STDMETHODCALLTYPE GetFileSize(UINT64* file_size) override; | 192 HRESULT STDMETHODCALLTYPE GetFileSize(UINT64* file_size) override; |
| 194 HRESULT STDMETHODCALLTYPE GetLastWriteTime(UINT64* last_write_time) override; | 193 HRESULT STDMETHODCALLTYPE GetLastWriteTime(UINT64* last_write_time) override; |
| 195 HRESULT STDMETHODCALLTYPE ReadFileFragment(const void** fragment_start, | 194 HRESULT STDMETHODCALLTYPE ReadFileFragment(const void** fragment_start, |
| 196 UINT64 file_offset, | 195 UINT64 file_offset, |
| 197 UINT64 fragment_size, | 196 UINT64 fragment_size, |
| 198 void** fragment_context) override; | 197 void** fragment_context) override; |
| 199 void STDMETHODCALLTYPE ReleaseFileFragment(void* fragment_context) override {} | 198 void STDMETHODCALLTYPE ReleaseFileFragment(void* fragment_context) override {} |
| 200 | 199 |
| 201 HRESULT STDMETHODCALLTYPE | 200 HRESULT STDMETHODCALLTYPE |
| 202 RuntimeClassInitialize(const base::string16& file_name); | 201 RuntimeClassInitialize(const base::string16& file_name); |
| 203 | 202 |
| 204 private: | 203 private: |
| 205 base::MemoryMappedFile data_; | 204 base::MemoryMappedFile data_; |
| 206 | 205 |
| 207 DISALLOW_ASSIGN(FontFileStream); | 206 DISALLOW_ASSIGN(FontFileStream); |
| 208 }; | 207 }; |
| 209 | 208 |
| 210 } // namespace content | 209 } // namespace content |
| 211 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 210 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
| OLD | NEW |