| 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 <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
| 9 #include <sys/poll.h> | 9 #include <sys/poll.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 PLOG(WARNING) << "poll"; | 162 PLOG(WARNING) << "poll"; |
| 163 if (failed_polls++ == 3) { | 163 if (failed_polls++ == 3) { |
| 164 LOG(FATAL) << "poll(2) failing. RenderSandboxHostLinux aborting."; | 164 LOG(FATAL) << "poll(2) failing. RenderSandboxHostLinux aborting."; |
| 165 return; | 165 return; |
| 166 } | 166 } |
| 167 continue; | 167 continue; |
| 168 } | 168 } |
| 169 | 169 |
| 170 failed_polls = 0; | 170 failed_polls = 0; |
| 171 | 171 |
| 172 // The browser process will close the other end of this pipe on shutdown, |
| 173 // so we should exit. |
| 172 if (pfds[0].revents) { | 174 if (pfds[0].revents) { |
| 173 // our parent died so we should too. | 175 break; |
| 174 _exit(0); | |
| 175 } | 176 } |
| 176 | 177 |
| 177 if (pfds[1].revents) { | 178 if (pfds[1].revents) { |
| 178 HandleRequestFromRenderer(browser_socket_); | 179 HandleRequestFromRenderer(browser_socket_); |
| 179 } | 180 } |
| 180 } | 181 } |
| 182 |
| 183 VLOG(1) << "SandboxIPCProcess stopping."; |
| 181 } | 184 } |
| 182 | 185 |
| 183 void SandboxIPCProcess::HandleRequestFromRenderer(int fd) { | 186 void SandboxIPCProcess::HandleRequestFromRenderer(int fd) { |
| 184 ScopedVector<base::ScopedFD> fds; | 187 ScopedVector<base::ScopedFD> fds; |
| 185 | 188 |
| 186 // A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength | 189 // A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength |
| 187 // bytes long (this is the largest message type). | 190 // bytes long (this is the largest message type). |
| 188 // 128 bytes padding are necessary so recvmsg() does not return MSG_TRUNC | 191 // 128 bytes padding are necessary so recvmsg() does not return MSG_TRUNC |
| 189 // error for a maximum length message. | 192 // error for a maximum length message. |
| 190 char buf[FontConfigIPC::kMaxFontFamilyLength + 128]; | 193 char buf[FontConfigIPC::kMaxFontFamilyLength + 128]; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 620 } |
| 618 | 621 |
| 619 void SandboxIPCProcess::EnsureWebKitInitialized() { | 622 void SandboxIPCProcess::EnsureWebKitInitialized() { |
| 620 if (webkit_platform_support_) | 623 if (webkit_platform_support_) |
| 621 return; | 624 return; |
| 622 webkit_platform_support_.reset(new BlinkPlatformImpl); | 625 webkit_platform_support_.reset(new BlinkPlatformImpl); |
| 623 blink::initializeWithoutV8(webkit_platform_support_.get()); | 626 blink::initializeWithoutV8(webkit_platform_support_.get()); |
| 624 } | 627 } |
| 625 | 628 |
| 626 } // namespace content | 629 } // namespace content |
| OLD | NEW |