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 <sys/socket.h> | 7 #include <sys/socket.h> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 // Runs on the main thread at startup. | 14 // Runs on the main thread at startup. |
15 RenderSandboxHostLinux::RenderSandboxHostLinux() | 15 RenderSandboxHostLinux::RenderSandboxHostLinux() |
16 : initialized_(false), renderer_socket_(0), childs_lifeline_fd_(0) { | 16 : initialized_(false), renderer_socket_(0), childs_lifeline_fd_(0) { |
17 } | 17 } |
18 | 18 |
19 // static | 19 // static |
20 RenderSandboxHostLinux* RenderSandboxHostLinux::GetInstance() { | 20 RenderSandboxHostLinux* RenderSandboxHostLinux::GetInstance() { |
21 return Singleton<RenderSandboxHostLinux>::get(); | 21 return base::Singleton<RenderSandboxHostLinux>::get(); |
22 } | 22 } |
23 | 23 |
24 void RenderSandboxHostLinux::Init() { | 24 void RenderSandboxHostLinux::Init() { |
25 DCHECK(!initialized_); | 25 DCHECK(!initialized_); |
26 initialized_ = true; | 26 initialized_ = true; |
27 | 27 |
28 int fds[2]; | 28 int fds[2]; |
29 // We use SOCK_SEQPACKET rather than SOCK_DGRAM to prevent the renderer from | 29 // We use SOCK_SEQPACKET rather than SOCK_DGRAM to prevent the renderer from |
30 // sending datagrams to other sockets on the system. The sandbox may prevent | 30 // sending datagrams to other sockets on the system. The sandbox may prevent |
31 // the renderer from calling socket() to create new sockets, but it'll still | 31 // the renderer from calling socket() to create new sockets, but it'll still |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 if (!ShutdownIPCChannel()) | 65 if (!ShutdownIPCChannel()) |
66 LOG(ERROR) << "ShutdownIPCChannel failed"; | 66 LOG(ERROR) << "ShutdownIPCChannel failed"; |
67 if (IGNORE_EINTR(close(renderer_socket_)) < 0) | 67 if (IGNORE_EINTR(close(renderer_socket_)) < 0) |
68 PLOG(ERROR) << "close"; | 68 PLOG(ERROR) << "close"; |
69 | 69 |
70 ipc_thread_->Join(); | 70 ipc_thread_->Join(); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 } // namespace content | 74 } // namespace content |
OLD | NEW |