| 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 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC | 5 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC |
| 6 | 6 |
| 7 #ifndef CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ | 7 #ifndef CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ |
| 8 #define CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ | 8 #define CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/pickle.h" | 14 #include "base/pickle.h" |
| 15 #include "content/child/blink_platform_impl.h" | 15 #include "content/child/blink_platform_impl.h" |
| 16 #include "skia/ext/skia_utils_base.h" | 16 #include "skia/ext/skia_utils_base.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class SandboxIPCProcess { | 20 class SandboxIPCProcess { |
| 21 public: | 21 public: |
| 22 // lifeline_fd: this is the read end of a pipe which the browser process | 22 // lifeline_fd: this is the read end of a pipe which the browser process |
| 23 // holds the other end of. If the browser process dies, its descriptors are | 23 // holds the other end of. If the browser process dies, its descriptors are |
| 24 // closed and we will noticed an EOF on the pipe. That's our signal to exit. | 24 // closed and we will noticed an EOF on the pipe. That's our signal to exit. |
| 25 // browser_socket: the browser's end of the sandbox IPC socketpair. From the | 25 // browser_socket: the browser's end of the sandbox IPC socketpair. From the |
| 26 // point of view of the renderer, it's talking to the browser but this | 26 // point of view of the renderer, it's talking to the browser but this |
| 27 // object actually services the requests. | 27 // object actually services the requests. |
| 28 // sandbox_cmd: the path of the sandbox executable. | 28 // sandbox_cmd: the path of the sandbox executable. |
| 29 SandboxIPCProcess(int lifeline_fd, | 29 SandboxIPCProcess(int lifeline_fd, int browser_socket); |
| 30 int browser_socket, | |
| 31 std::string sandbox_cmd); | |
| 32 ~SandboxIPCProcess(); | 30 ~SandboxIPCProcess(); |
| 33 | 31 |
| 34 void Run(); | 32 void Run(); |
| 35 | 33 |
| 36 private: | 34 private: |
| 37 void EnsureWebKitInitialized(); | 35 void EnsureWebKitInitialized(); |
| 38 | 36 |
| 39 int FindOrAddPath(const SkString& path); | 37 int FindOrAddPath(const SkString& path); |
| 40 | 38 |
| 41 void HandleRequestFromRenderer(int fd); | 39 void HandleRequestFromRenderer(int fd); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 58 void HandleGetStyleForStrike(int fd, | 56 void HandleGetStyleForStrike(int fd, |
| 59 const Pickle& pickle, | 57 const Pickle& pickle, |
| 60 PickleIterator iter, | 58 PickleIterator iter, |
| 61 const std::vector<base::ScopedFD*>& fds); | 59 const std::vector<base::ScopedFD*>& fds); |
| 62 | 60 |
| 63 void HandleLocaltime(int fd, | 61 void HandleLocaltime(int fd, |
| 64 const Pickle& pickle, | 62 const Pickle& pickle, |
| 65 PickleIterator iter, | 63 PickleIterator iter, |
| 66 const std::vector<base::ScopedFD*>& fds); | 64 const std::vector<base::ScopedFD*>& fds); |
| 67 | 65 |
| 68 void HandleGetChildWithInode(int fd, | |
| 69 const Pickle& pickle, | |
| 70 PickleIterator iter, | |
| 71 const std::vector<base::ScopedFD*>& fds); | |
| 72 | |
| 73 void HandleMakeSharedMemorySegment(int fd, | 66 void HandleMakeSharedMemorySegment(int fd, |
| 74 const Pickle& pickle, | 67 const Pickle& pickle, |
| 75 PickleIterator iter, | 68 PickleIterator iter, |
| 76 const std::vector<base::ScopedFD*>& fds); | 69 const std::vector<base::ScopedFD*>& fds); |
| 77 | 70 |
| 78 void HandleMatchWithFallback(int fd, | 71 void HandleMatchWithFallback(int fd, |
| 79 const Pickle& pickle, | 72 const Pickle& pickle, |
| 80 PickleIterator iter, | 73 PickleIterator iter, |
| 81 const std::vector<base::ScopedFD*>& fds); | 74 const std::vector<base::ScopedFD*>& fds); |
| 82 | 75 |
| 83 void SendRendererReply(const std::vector<base::ScopedFD*>& fds, | 76 void SendRendererReply(const std::vector<base::ScopedFD*>& fds, |
| 84 const Pickle& reply, | 77 const Pickle& reply, |
| 85 int reply_fd); | 78 int reply_fd); |
| 86 | 79 |
| 87 const int lifeline_fd_; | 80 const int lifeline_fd_; |
| 88 const int browser_socket_; | 81 const int browser_socket_; |
| 89 std::vector<std::string> sandbox_cmd_; | |
| 90 scoped_ptr<BlinkPlatformImpl> webkit_platform_support_; | 82 scoped_ptr<BlinkPlatformImpl> webkit_platform_support_; |
| 91 SkTDArray<SkString*> paths_; | 83 SkTDArray<SkString*> paths_; |
| 92 | 84 |
| 93 DISALLOW_COPY_AND_ASSIGN(SandboxIPCProcess); | 85 DISALLOW_COPY_AND_ASSIGN(SandboxIPCProcess); |
| 94 }; | 86 }; |
| 95 | 87 |
| 96 } // namespace content | 88 } // namespace content |
| 97 | 89 |
| 98 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ | 90 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ |
| OLD | NEW |