Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMMON_FONT_CONFIG_IPC_LINUX_H_ | 5 #ifndef CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ |
| 6 #define CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ | 6 #define CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/containers/hash_tables.h" | |
| 10 #include "base/synchronization/lock.h" | |
| 9 #include "third_party/skia/include/ports/SkFontConfigInterface.h" | 11 #include "third_party/skia/include/ports/SkFontConfigInterface.h" |
| 10 | 12 |
| 11 #include <string> | 13 #include <string> |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 | 16 |
| 15 // FontConfig implementation for Skia that proxies out of process to get out | 17 // FontConfig implementation for Skia that proxies out of process to get out |
| 16 // of the sandbox. See http://code.google.com/p/chromium/wiki/LinuxSandboxIPC | 18 // of the sandbox. See http://code.google.com/p/chromium/wiki/LinuxSandboxIPC |
| 17 class FontConfigIPC : public SkFontConfigInterface { | 19 class FontConfigIPC : public SkFontConfigInterface { |
| 18 public: | 20 public: |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 30 enum Method { | 32 enum Method { |
| 31 METHOD_MATCH = 0, | 33 METHOD_MATCH = 0, |
| 32 METHOD_OPEN = 1, | 34 METHOD_OPEN = 1, |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 enum { | 37 enum { |
| 36 kMaxFontFamilyLength = 2048 | 38 kMaxFontFamilyLength = 2048 |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 private: | 41 private: |
| 42 class MappedFontFile; | |
| 43 friend class MappedFontFile; | |
|
Daniel Erat
2015/01/14 23:40:27
(mostly a note for myself: i initially thought tha
Krzysztof Olczyk
2015/01/15 09:05:28
Oh, I wasn't aware it was addressed in C++11, than
Daniel Erat
2015/01/15 15:55:54
sorry, i meant it the other way around: apparently
Krzysztof Olczyk
2015/01/15 17:44:11
I think it's other way round. I'm pretty sure frie
| |
| 44 | |
| 45 // Removes |mapped_font_file| from |mapped_font_files_|. | |
| 46 // Does not delete the passed-in object. | |
| 47 void RemoveMappedFontFile(MappedFontFile* mapped_font_file); | |
| 48 | |
| 40 const int fd_; | 49 const int fd_; |
| 50 // Lock preventing multiple threads from opening font file and accessing | |
| 51 // |mapped_font_files_| map at the same time. | |
| 52 base::Lock stream_opening_lock_; | |
|
Daniel Erat
2015/01/14 23:40:27
nit: just rename this to |lock_| since it protects
Krzysztof Olczyk
2015/01/15 09:05:28
Done.
| |
| 53 // Maps font identity ID to the memory-mapped file with font data. | |
| 54 base::hash_map<uint32_t, MappedFontFile*> mapped_font_files_; | |
| 41 }; | 55 }; |
| 42 | 56 |
| 43 } // namespace content | 57 } // namespace content |
| 44 | 58 |
| 45 #endif // CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ | 59 #endif // CONTENT_COMMON_FONT_CONFIG_IPC_LINUX_H_ |
| OLD | NEW |