[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
mostynb | df175a8 | 2016-02-08 23:27:20 | [diff] [blame] | 5 | // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ipc.md |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 6 | |
Vladimir Levin | 11a23b1 | 2017-09-11 23:13:30 | [diff] [blame] | 7 | #ifndef CONTENT_BROWSER_SANDBOX_IPC_LINUX_H_ |
8 | #define CONTENT_BROWSER_SANDBOX_IPC_LINUX_H_ | ||||
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 9 | |
dcheng | 92ae1414 | 2016-04-09 02:52:24 | [diff] [blame] | 10 | #include <memory> |
zoeclifford | 525974c | 2017-05-17 20:31:06 | [diff] [blame] | 11 | #include <string> |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 12 | #include <vector> |
13 | |||||
[email protected] | 8feaa67 | 2014-04-30 21:57:10 | [diff] [blame] | 14 | #include "base/files/scoped_file.h" |
avi | b533f5d | 2015-12-25 03:11:15 | [diff] [blame] | 15 | #include "base/macros.h" |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 16 | #include "base/pickle.h" |
[email protected] | ef0dad53c | 2014-05-23 11:31:19 | [diff] [blame] | 17 | #include "base/threading/simple_thread.h" |
zoeclifford | 525974c | 2017-05-17 20:31:06 | [diff] [blame] | 18 | #include "content/common/content_export.h" |
19 | #include "third_party/icu/source/common/unicode/uchar.h" | ||||
tomhudson | 55241b6 | 2016-05-27 14:03:18 | [diff] [blame] | 20 | |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 21 | namespace content { |
22 | |||||
[email protected] | ef0dad53c | 2014-05-23 11:31:19 | [diff] [blame] | 23 | class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate { |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 24 | public: |
[email protected] | ef0dad53c | 2014-05-23 11:31:19 | [diff] [blame] | 25 | // lifeline_fd: the read end of a pipe which the main thread holds |
26 | // the other end of. | ||||
27 | // browser_socket: the browser's end of the sandbox IPC socketpair. | ||||
28 | SandboxIPCHandler(int lifeline_fd, int browser_socket); | ||||
dcheng | 4c112747 | 2014-10-28 00:01:20 | [diff] [blame] | 29 | ~SandboxIPCHandler() override; |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 30 | |
dcheng | 4c112747 | 2014-10-28 00:01:20 | [diff] [blame] | 31 | void Run() override; |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 32 | |
33 | private: | ||||
Vladimir Levin | 11a23b1 | 2017-09-11 23:13:30 | [diff] [blame] | 34 | void HandleRequestFromChild(int fd); |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 35 | |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 36 | void HandleMakeSharedMemorySegment(int fd, |
brettw | 05cfd8ddb | 2015-06-02 07:02:47 | [diff] [blame] | 37 | base::PickleIterator iter, |
mdempsky | f12295a | 2015-12-09 22:54:46 | [diff] [blame] | 38 | const std::vector<base::ScopedFD>& fds); |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 39 | |
mdempsky | f12295a | 2015-12-09 22:54:46 | [diff] [blame] | 40 | void SendRendererReply(const std::vector<base::ScopedFD>& fds, |
brettw | 05cfd8ddb | 2015-06-02 07:02:47 | [diff] [blame] | 41 | const base::Pickle& reply, |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 42 | int reply_fd); |
43 | |||||
[email protected] | 972a9995 | 2014-05-01 20:41:22 | [diff] [blame] | 44 | const int lifeline_fd_; |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 45 | const int browser_socket_; |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 46 | |
[email protected] | ef0dad53c | 2014-05-23 11:31:19 | [diff] [blame] | 47 | DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler); |
[email protected] | ac0a3f0 | 2014-04-24 03:34:16 | [diff] [blame] | 48 | }; |
49 | |||||
50 | } // namespace content | ||||
51 | |||||
tfarina | bccc34c7 | 2015-02-27 21:32:15 | [diff] [blame] | 52 | #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_ |