| 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/browser/renderer_host/render_sandbox_host_linux.h" | 5 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <sys/poll.h> | 10 #include <sys/poll.h> |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 reply.WriteBool(false); | 234 reply.WriteBool(false); |
| 235 } else { | 235 } else { |
| 236 reply.WriteBool(true); | 236 reply.WriteBool(true); |
| 237 } | 237 } |
| 238 | 238 |
| 239 // The receiver will have its own access to the file, so we will close it | 239 // The receiver will have its own access to the file, so we will close it |
| 240 // after this send. | 240 // after this send. |
| 241 SendRendererReply(fds, reply, result_fd); | 241 SendRendererReply(fds, reply, result_fd); |
| 242 | 242 |
| 243 if (result_fd >= 0) { | 243 if (result_fd >= 0) { |
| 244 int err = HANDLE_EINTR(close(result_fd)); | 244 int err = IGNORE_EINTR(close(result_fd)); |
| 245 DCHECK(!err); | 245 DCHECK(!err); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 void HandleGetFontFamilyForChar(int fd, const Pickle& pickle, | 249 void HandleGetFontFamilyForChar(int fd, const Pickle& pickle, |
| 250 PickleIterator iter, | 250 PickleIterator iter, |
| 251 std::vector<int>& fds) { | 251 std::vector<int>& fds) { |
| 252 // The other side of this call is | 252 // The other side of this call is |
| 253 // chrome/renderer/renderer_sandbox_support_linux.cc | 253 // chrome/renderer/renderer_sandbox_support_linux.cc |
| 254 | 254 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 509 } |
| 510 | 510 |
| 511 if (font_set) | 511 if (font_set) |
| 512 FcFontSetDestroy(font_set); | 512 FcFontSetDestroy(font_set); |
| 513 FcPatternDestroy(pattern); | 513 FcPatternDestroy(pattern); |
| 514 | 514 |
| 515 Pickle reply; | 515 Pickle reply; |
| 516 SendRendererReply(fds, reply, font_fd); | 516 SendRendererReply(fds, reply, font_fd); |
| 517 | 517 |
| 518 if (font_fd >= 0) { | 518 if (font_fd >= 0) { |
| 519 if (HANDLE_EINTR(close(font_fd)) < 0) | 519 if (IGNORE_EINTR(close(font_fd)) < 0) |
| 520 PLOG(ERROR) << "close"; | 520 PLOG(ERROR) << "close"; |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 | 523 |
| 524 // MSCharSetToFontconfig translates a Microsoft charset identifier to a | 524 // MSCharSetToFontconfig translates a Microsoft charset identifier to a |
| 525 // fontconfig language set by appending to |langset|. | 525 // fontconfig language set by appending to |langset|. |
| 526 static void MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) { | 526 static void MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) { |
| 527 // We have need to translate raw fdwCharSet values into terms that | 527 // We have need to translate raw fdwCharSet values into terms that |
| 528 // fontconfig can understand. (See the description of fdwCharSet in the MSDN | 528 // fontconfig can understand. (See the description of fdwCharSet in the MSDN |
| 529 // documentation for CreateFont: | 529 // documentation for CreateFont: |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 // We need to be monothreaded before we fork(). | 711 // We need to be monothreaded before we fork(). |
| 712 #if !defined(TOOLKIT_GTK) && !defined(OS_CHROMEOS) | 712 #if !defined(TOOLKIT_GTK) && !defined(OS_CHROMEOS) |
| 713 // Exclude gtk port as TestSuite in base/tests/test_suite.cc is calling | 713 // Exclude gtk port as TestSuite in base/tests/test_suite.cc is calling |
| 714 // gtk_init. | 714 // gtk_init. |
| 715 // Exclude ChromeOS because KioskTest spawns EmbeddedTestServer. | 715 // Exclude ChromeOS because KioskTest spawns EmbeddedTestServer. |
| 716 // TODO(oshima): Remove ifdef when above issues are resolved. | 716 // TODO(oshima): Remove ifdef when above issues are resolved. |
| 717 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); | 717 DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); |
| 718 #endif | 718 #endif |
| 719 pid_ = fork(); | 719 pid_ = fork(); |
| 720 if (pid_ == 0) { | 720 if (pid_ == 0) { |
| 721 if (HANDLE_EINTR(close(fds[0])) < 0) | 721 if (IGNORE_EINTR(close(fds[0])) < 0) |
| 722 DPLOG(ERROR) << "close"; | 722 DPLOG(ERROR) << "close"; |
| 723 if (HANDLE_EINTR(close(pipefds[1])) < 0) | 723 if (IGNORE_EINTR(close(pipefds[1])) < 0) |
| 724 DPLOG(ERROR) << "close"; | 724 DPLOG(ERROR) << "close"; |
| 725 | 725 |
| 726 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); | 726 SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path); |
| 727 handler.Run(); | 727 handler.Run(); |
| 728 _exit(0); | 728 _exit(0); |
| 729 } | 729 } |
| 730 } | 730 } |
| 731 | 731 |
| 732 RenderSandboxHostLinux::~RenderSandboxHostLinux() { | 732 RenderSandboxHostLinux::~RenderSandboxHostLinux() { |
| 733 if (initialized_) { | 733 if (initialized_) { |
| 734 if (HANDLE_EINTR(close(renderer_socket_)) < 0) | 734 if (IGNORE_EINTR(close(renderer_socket_)) < 0) |
| 735 PLOG(ERROR) << "close"; | 735 PLOG(ERROR) << "close"; |
| 736 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0) | 736 if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0) |
| 737 PLOG(ERROR) << "close"; | 737 PLOG(ERROR) << "close"; |
| 738 } | 738 } |
| 739 } | 739 } |
| 740 | 740 |
| 741 } // namespace content | 741 } // namespace content |
| OLD | NEW |