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/child_process_sandbox_support_impl_linux.h" | 5 #include "content/common/child_process_sandbox_support_impl_linux.h" |
| 6 | 6 |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| 11 #include "base/posix/unix_domain_socket_linux.h" | |
| 12 #include "content/common/zygote_commands_linux.h" | |
| 13 | |
| 14 #if !defined(OS_NACL_NONSFI) | |
| 11 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 12 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
| 13 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/numerics/safe_conversions.h" | 18 #include "base/numerics/safe_conversions.h" |
| 15 #include "base/pickle.h" | 19 #include "base/pickle.h" |
| 16 #include "base/posix/eintr_wrapper.h" | 20 #include "base/posix/eintr_wrapper.h" |
| 17 #include "base/posix/unix_domain_socket_linux.h" | |
| 18 #include "base/sys_byteorder.h" | 21 #include "base/sys_byteorder.h" |
| 19 #include "content/common/sandbox_linux/sandbox_linux.h" | 22 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 20 #include "content/common/zygote_commands_linux.h" | |
| 21 #include "third_party/WebKit/public/platform/linux/WebFallbackFont.h" | 23 #include "third_party/WebKit/public/platform/linux/WebFallbackFont.h" |
| 22 #include "third_party/WebKit/public/platform/linux/WebFontRenderStyle.h" | 24 #include "third_party/WebKit/public/platform/linux/WebFontRenderStyle.h" |
| 25 #endif // !defined(OS_NACL_NONSFI) | |
| 23 | 26 |
| 24 namespace content { | 27 namespace content { |
| 25 | 28 |
| 29 #if !defined(OS_NACL_NONSFI) | |
| 26 void GetFallbackFontForCharacter(int32_t character, | 30 void GetFallbackFontForCharacter(int32_t character, |
| 27 const char* preferred_locale, | 31 const char* preferred_locale, |
| 28 blink::WebFallbackFont* fallbackFont) { | 32 blink::WebFallbackFont* fallbackFont) { |
| 29 TRACE_EVENT0("sandbox_ipc", "GetFontFamilyForCharacter"); | 33 TRACE_EVENT0("sandbox_ipc", "GetFontFamilyForCharacter"); |
| 30 | 34 |
| 31 Pickle request; | 35 Pickle request; |
| 32 request.WriteInt(LinuxSandbox::METHOD_GET_FALLBACK_FONT_FOR_CHAR); | 36 request.WriteInt(LinuxSandbox::METHOD_GET_FALLBACK_FONT_FOR_CHAR); |
| 33 request.WriteInt(character); | 37 request.WriteInt(character); |
| 34 request.WriteString(preferred_locale); | 38 request.WriteString(preferred_locale); |
| 35 | 39 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 // 'output_length' holds the maximum amount of data the caller can accept. | 201 // 'output_length' holds the maximum amount of data the caller can accept. |
| 198 data_length = std::min(data_length, *output_length); | 202 data_length = std::min(data_length, *output_length); |
| 199 ssize_t n = HANDLE_EINTR(pread(fd, output, data_length, data_offset)); | 203 ssize_t n = HANDLE_EINTR(pread(fd, output, data_length, data_offset)); |
| 200 if (n != base::checked_cast<ssize_t>(data_length)) | 204 if (n != base::checked_cast<ssize_t>(data_length)) |
| 201 return false; | 205 return false; |
| 202 } | 206 } |
| 203 *output_length = data_length; | 207 *output_length = data_length; |
| 204 | 208 |
| 205 return true; | 209 return true; |
| 206 } | 210 } |
| 211 #endif // !defined(OS_NACL_NONSFI) | |
| 207 | 212 |
| 208 bool SendZygoteChildPing(int fd) { | 213 bool SendZygoteChildPing(int fd) { |
|
jam
2014/10/30 22:45:48
why not move this to a separate file?
hidehiko
2014/10/31 07:03:39
Done.
| |
| 209 return UnixDomainSocket::SendMsg(fd, | 214 return UnixDomainSocket::SendMsg(fd, |
| 210 kZygoteChildPingMessage, | 215 kZygoteChildPingMessage, |
| 211 sizeof(kZygoteChildPingMessage), | 216 sizeof(kZygoteChildPingMessage), |
| 212 std::vector<int>()); | 217 std::vector<int>()); |
| 213 } | 218 } |
| 214 | 219 |
| 215 } // namespace content | 220 } // namespace content |
| OLD | NEW |