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 #include "content/common/font_config_ipc_linux.h" | 5 #include "content/common/font_config_ipc_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 base::PickleIterator iter(reply); | 151 base::PickleIterator iter(reply); |
| 152 if (!iter.ReadBool(&result) || !result) { | 152 if (!iter.ReadBool(&result) || !result) { |
| 153 if (result_fd) | 153 if (result_fd) |
| 154 CloseFD(result_fd); | 154 CloseFD(result_fd); |
| 155 return NULL; | 155 return NULL; |
| 156 } | 156 } |
| 157 | 157 |
| 158 return mapFileDescriptorToStream(result_fd); | 158 return mapFileDescriptorToStream(result_fd); |
| 159 } | 159 } |
| 160 | 160 |
| 161 SkTypeface* FontConfigIPC::createTypeface( | 161 sk_sp<SkTypeface> FontConfigIPC::makeTypeface( |
| 162 const SkFontConfigInterface::FontIdentity& identity) { | 162 const SkFontConfigInterface::FontIdentity& identity) { |
| 163 base::AutoLock lock(lock_); | 163 base::AutoLock lock(lock_); |
| 164 auto mapped_typefaces_it = mapped_typefaces_.Get(identity); | 164 auto mapped_typefaces_it = mapped_typefaces_.Get(identity); |
| 165 if (mapped_typefaces_it != mapped_typefaces_.end()) | 165 if (mapped_typefaces_it != mapped_typefaces_.end()) |
| 166 return SkSafeRef(mapped_typefaces_it->second.get()); | 166 return mapped_typefaces_it->second; |
| 167 | 167 |
| 168 SkStreamAsset* typeface_stream = openStream(identity); | 168 SkStreamAsset* typeface_stream = openStream(identity); |
| 169 if (!typeface_stream) | 169 if (!typeface_stream) |
| 170 return nullptr; | 170 return nullptr; |
| 171 sk_sp<SkTypeface> typeface_from_stream( | 171 sk_sp<SkTypeface> typeface_from_stream( |
| 172 SkTypeface::CreateFromStream(typeface_stream, identity.fTTCIndex)); | 172 SkTypeface::CreateFromStream(typeface_stream, identity.fTTCIndex)); |
|
f(malita)
2016/06/03 17:11:59
SkTypeface::MakeFromStream while here?
bungeman-chromium
2016/06/03 18:28:18
Done.
| |
| 173 auto mapped_typefaces_insert_it = | 173 auto mapped_typefaces_insert_it = |
| 174 mapped_typefaces_.Put(identity, typeface_from_stream); | 174 mapped_typefaces_.Put(identity, typeface_from_stream); |
| 175 return SkSafeRef(mapped_typefaces_insert_it->second.get()); | 175 return mapped_typefaces_insert_it->second; |
|
f(malita)
2016/06/03 17:11:59
Not new to this CL, but I wonder if it'd help to r
bungeman-chromium
2016/06/03 18:28:18
Ah, I see, the stack has a ref and then the map ge
f(malita)
2016/06/03 19:04:03
Awesome, thanks!
| |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace content | 178 } // namespace content |
| OLD | NEW |