OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/renderer_host/sandbox_ipc_linux.h" | 5 #include "content/browser/renderer_host/sandbox_ipc_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 int fd, | 173 int fd, |
174 base::PickleIterator iter, | 174 base::PickleIterator iter, |
175 const std::vector<base::ScopedFD>& fds) { | 175 const std::vector<base::ScopedFD>& fds) { |
176 uint32_t requested_style; | 176 uint32_t requested_style; |
177 std::string family; | 177 std::string family; |
178 if (!iter.ReadString(&family) || !iter.ReadUInt32(&requested_style)) | 178 if (!iter.ReadString(&family) || !iter.ReadUInt32(&requested_style)) |
179 return; | 179 return; |
180 | 180 |
181 SkFontConfigInterface::FontIdentity result_identity; | 181 SkFontConfigInterface::FontIdentity result_identity; |
182 SkString result_family; | 182 SkString result_family; |
183 SkTypeface::Style result_style; | 183 SkFontStyle result_style; |
184 SkFontConfigInterface* fc = | 184 SkFontConfigInterface* fc = |
185 SkFontConfigInterface::GetSingletonDirectInterface(); | 185 SkFontConfigInterface::GetSingletonDirectInterface(); |
186 const bool r = | 186 const bool r = |
187 fc->matchFamilyName(family.c_str(), | 187 fc->matchFamilyName(family.c_str(), |
188 static_cast<SkTypeface::Style>(requested_style), | 188 static_cast<SkFontStyle>(requested_style), |
189 &result_identity, | 189 &result_identity, |
190 &result_family, | 190 &result_family, |
191 &result_style); | 191 &result_style); |
192 | 192 |
193 base::Pickle reply; | 193 base::Pickle reply; |
194 if (!r) { | 194 if (!r) { |
195 reply.WriteBool(false); | 195 reply.WriteBool(false); |
196 } else { | 196 } else { |
197 // Stash away the returned path, so we can give it an ID (index) | 197 // Stash away the returned path, so we can give it an ID (index) |
198 // which will later be given to us in a request to open the file. | 198 // which will later be given to us in a request to open the file. |
199 int index = FindOrAddPath(result_identity.fString); | 199 int index = FindOrAddPath(result_identity.fString); |
200 result_identity.fID = static_cast<uint32_t>(index); | 200 result_identity.fID = static_cast<uint32_t>(index); |
201 | 201 |
202 reply.WriteBool(true); | 202 reply.WriteBool(true); |
203 skia::WriteSkString(&reply, result_family); | 203 skia::WriteSkString(&reply, result_family); |
204 skia::WriteSkFontIdentity(&reply, result_identity); | 204 skia::WriteSkFontIdentity(&reply, result_identity); |
205 reply.WriteUInt32(result_style); | 205 reply.WriteUInt32(static_cast<uint32_t>(result_style)); |
206 } | 206 } |
207 SendRendererReply(fds, reply, -1); | 207 SendRendererReply(fds, reply, -1); |
208 } | 208 } |
209 | 209 |
210 void SandboxIPCHandler::HandleFontOpenRequest( | 210 void SandboxIPCHandler::HandleFontOpenRequest( |
211 int fd, | 211 int fd, |
212 base::PickleIterator iter, | 212 base::PickleIterator iter, |
213 const std::vector<base::ScopedFD>& fds) { | 213 const std::vector<base::ScopedFD>& fds) { |
214 uint32_t index; | 214 uint32_t index; |
215 if (!iter.ReadUInt32(&index)) | 215 if (!iter.ReadUInt32(&index)) |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 414 } |
415 | 415 |
416 SandboxIPCHandler::~SandboxIPCHandler() { | 416 SandboxIPCHandler::~SandboxIPCHandler() { |
417 if (IGNORE_EINTR(close(lifeline_fd_)) < 0) | 417 if (IGNORE_EINTR(close(lifeline_fd_)) < 0) |
418 PLOG(ERROR) << "close"; | 418 PLOG(ERROR) << "close"; |
419 if (IGNORE_EINTR(close(browser_socket_)) < 0) | 419 if (IGNORE_EINTR(close(browser_socket_)) < 0) |
420 PLOG(ERROR) << "close"; | 420 PLOG(ERROR) << "close"; |
421 } | 421 } |
422 | 422 |
423 } // namespace content | 423 } // namespace content |
OLD | NEW |