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

Unified Diff: content/child/dwrite_font_proxy/dwrite_font_proxy_win.h

Issue 2153343002: Implement support for loading font files from outside system directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor cast Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/child/dwrite_font_proxy/dwrite_font_proxy_win.h
diff --git a/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h b/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h
index 555876026d1c4c8d7b2046ec25de7bea7772743d..4cf3cdf8224d8c1af762c913d280c807e99f3546 100644
--- a/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h
+++ b/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h
@@ -8,6 +8,7 @@
#include <dwrite.h>
#include <wrl.h>
+#include <deque>
#include <map>
#include <vector>
@@ -81,7 +82,37 @@ class CONTENT_EXPORT DWriteFontCollectionProxy
bool CreateFamily(UINT32 family_index);
+ size_t CreateFontFileReference(base::string16 file_path);
ananta 2016/07/20 01:34:59 Newline between functions. Please use different na
Ilya Kulshin 2016/07/21 04:17:37 Removed this code due to a refactor.
+ size_t CreateFontFileReference(HANDLE file_handle);
+
private:
+ class FontFileReference {
ananta 2016/07/20 01:34:59 Please add some comments for this class.
Ilya Kulshin 2016/07/21 04:17:38 Removed this class due to a refactor.
+ public:
+ enum ReferenceType {
+ INVALID,
+ PATH,
+ FILE,
+ };
+
+ explicit FontFileReference(base::string16 file_path);
ananta 2016/07/20 01:34:59 const reference for string16.
Ilya Kulshin 2016/07/21 04:17:37 Done.
+ explicit FontFileReference(HANDLE file_handle);
+
+ ReferenceType Type() const { return reference_type_; }
+ const base::string16* Path() const {
ananta 2016/07/20 01:34:59 newline
Ilya Kulshin 2016/07/21 04:17:37 Done.
+ DCHECK_EQ(Type(), PATH);
+ return &file_path_;
+ }
+ const base::File* File() const {
ananta 2016/07/20 01:34:59 newline
Ilya Kulshin 2016/07/21 04:17:38 Done.
+ DCHECK_EQ(Type(), FILE);
+ return &file_;
+ }
+
+ private:
+ ReferenceType reference_type_;
+ base::string16 file_path_;
+ base::File file_;
+ };
+
IPC::Sender* GetSender();
Microsoft::WRL::ComPtr<IDWriteFactory> factory_;
@@ -90,6 +121,8 @@ class CONTENT_EXPORT DWriteFontCollectionProxy
UINT32 family_count_ = UINT_MAX;
IPC::Sender* sender_override_;
+ std::deque<FontFileReference> font_files_;
+
DISALLOW_ASSIGN(DWriteFontCollectionProxy);
};
@@ -164,13 +197,12 @@ class CONTENT_EXPORT FontFileEnumerator
HRESULT STDMETHODCALLTYPE
RuntimeClassInitialize(IDWriteFactory* factory,
IDWriteFontFileLoader* loader,
- std::vector<base::string16>* file_names);
+ std::vector<size_t>* file_references);
private:
Microsoft::WRL::ComPtr<IDWriteFactory> factory_;
Microsoft::WRL::ComPtr<IDWriteFontFileLoader> loader_;
- std::vector<base::string16> file_names_;
- std::vector<Microsoft::WRL::ComPtr<IDWriteFontFileStream>> file_streams_;
+ std::vector<size_t> file_references_;
nasko 2016/07/20 16:40:03 Since this is Windows specific code, why not use H
Ilya Kulshin 2016/07/21 04:17:38 Done.
UINT32 next_file_ = 0;
UINT32 current_file_ = UINT_MAX;
@@ -198,7 +230,8 @@ class CONTENT_EXPORT FontFileStream
void STDMETHODCALLTYPE ReleaseFileFragment(void* fragment_context) override {}
HRESULT STDMETHODCALLTYPE
- RuntimeClassInitialize(const base::string16& file_name);
+ RuntimeClassInitialize(const base::string16* file_name);
+ HRESULT STDMETHODCALLTYPE RuntimeClassInitialize(const base::File* file);
private:
base::MemoryMappedFile data_;

Powered by Google App Engine
This is Rietveld 408576698