blob: 684a6aa0825da4655203110900d16621d3e5d288 [file] [log] [blame]
[email protected]ac0a3f02014-04-24 03:34:161// 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
mostynbdf175a82016-02-08 23:27:205// https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ipc.md
[email protected]ac0a3f02014-04-24 03:34:166
Vladimir Levin11a23b12017-09-11 23:13:307#ifndef CONTENT_BROWSER_SANDBOX_IPC_LINUX_H_
8#define CONTENT_BROWSER_SANDBOX_IPC_LINUX_H_
[email protected]ac0a3f02014-04-24 03:34:169
dcheng92ae14142016-04-09 02:52:2410#include <memory>
zoeclifford525974c2017-05-17 20:31:0611#include <string>
[email protected]ac0a3f02014-04-24 03:34:1612#include <vector>
13
[email protected]8feaa672014-04-30 21:57:1014#include "base/files/scoped_file.h"
avib533f5d2015-12-25 03:11:1515#include "base/macros.h"
[email protected]ac0a3f02014-04-24 03:34:1616#include "base/pickle.h"
[email protected]ef0dad53c2014-05-23 11:31:1917#include "base/threading/simple_thread.h"
zoeclifford525974c2017-05-17 20:31:0618#include "content/common/content_export.h"
19#include "third_party/icu/source/common/unicode/uchar.h"
tomhudson55241b62016-05-27 14:03:1820
[email protected]ac0a3f02014-04-24 03:34:1621namespace content {
22
[email protected]ef0dad53c2014-05-23 11:31:1923class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate {
[email protected]ac0a3f02014-04-24 03:34:1624 public:
[email protected]ef0dad53c2014-05-23 11:31:1925 // 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);
dcheng4c1127472014-10-28 00:01:2029 ~SandboxIPCHandler() override;
[email protected]ac0a3f02014-04-24 03:34:1630
dcheng4c1127472014-10-28 00:01:2031 void Run() override;
[email protected]ac0a3f02014-04-24 03:34:1632
33 private:
Vladimir Levin11a23b12017-09-11 23:13:3034 void HandleRequestFromChild(int fd);
[email protected]ac0a3f02014-04-24 03:34:1635
[email protected]ac0a3f02014-04-24 03:34:1636 void HandleMakeSharedMemorySegment(int fd,
brettw05cfd8ddb2015-06-02 07:02:4737 base::PickleIterator iter,
mdempskyf12295a2015-12-09 22:54:4638 const std::vector<base::ScopedFD>& fds);
[email protected]ac0a3f02014-04-24 03:34:1639
mdempskyf12295a2015-12-09 22:54:4640 void SendRendererReply(const std::vector<base::ScopedFD>& fds,
brettw05cfd8ddb2015-06-02 07:02:4741 const base::Pickle& reply,
[email protected]ac0a3f02014-04-24 03:34:1642 int reply_fd);
43
[email protected]972a99952014-05-01 20:41:2244 const int lifeline_fd_;
[email protected]ac0a3f02014-04-24 03:34:1645 const int browser_socket_;
[email protected]ac0a3f02014-04-24 03:34:1646
[email protected]ef0dad53c2014-05-23 11:31:1947 DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler);
[email protected]ac0a3f02014-04-24 03:34:1648};
49
50} // namespace content
51
tfarinabccc34c72015-02-27 21:32:1552#endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_LINUX_H_