Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: content/browser/renderer_host/sandbox_ipc_linux.h

Issue 286903021: Make SandboxIPCProcess a thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Close FDs in ::~SandboxIPCHandler(). Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/threading/simple_thread.h"
15 #include "content/child/blink_platform_impl.h" 16 #include "content/child/blink_platform_impl.h"
16 #include "skia/ext/skia_utils_base.h" 17 #include "skia/ext/skia_utils_base.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 class SandboxIPCProcess { 21 class SandboxIPCHandler : public base::DelegateSimpleThread::Delegate {
21 public: 22 public:
22 // lifeline_fd: this is the read end of a pipe which the browser process 23 // lifeline_fd: the read end of a pipe which the main thread holds
23 // holds the other end of. If the browser process dies, its descriptors are 24 // the other end of.
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.
25 // browser_socket: the browser's end of the sandbox IPC socketpair. From the 26 SandboxIPCHandler(int lifeline_fd, int browser_socket);
26 // point of view of the renderer, it's talking to the browser but this 27 virtual ~SandboxIPCHandler();
27 // object actually services the requests.
28 // sandbox_cmd: the path of the sandbox executable.
29 SandboxIPCProcess(int lifeline_fd, int browser_socket);
30 ~SandboxIPCProcess();
31 28
32 void Run(); 29 virtual void Run() OVERRIDE;
33 30
34 private: 31 private:
35 void EnsureWebKitInitialized(); 32 void EnsureWebKitInitialized();
36 33
37 int FindOrAddPath(const SkString& path); 34 int FindOrAddPath(const SkString& path);
38 35
39 void HandleRequestFromRenderer(int fd); 36 void HandleRequestFromRenderer(int fd);
40 37
41 void HandleFontMatchRequest(int fd, 38 void HandleFontMatchRequest(int fd,
42 const Pickle& pickle, 39 const Pickle& pickle,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 72
76 void SendRendererReply(const std::vector<base::ScopedFD*>& fds, 73 void SendRendererReply(const std::vector<base::ScopedFD*>& fds,
77 const Pickle& reply, 74 const Pickle& reply,
78 int reply_fd); 75 int reply_fd);
79 76
80 const int lifeline_fd_; 77 const int lifeline_fd_;
81 const int browser_socket_; 78 const int browser_socket_;
82 scoped_ptr<BlinkPlatformImpl> webkit_platform_support_; 79 scoped_ptr<BlinkPlatformImpl> webkit_platform_support_;
83 SkTDArray<SkString*> paths_; 80 SkTDArray<SkString*> paths_;
84 81
85 DISALLOW_COPY_AND_ASSIGN(SandboxIPCProcess); 82 DISALLOW_COPY_AND_ASSIGN(SandboxIPCHandler);
86 }; 83 };
87 84
88 } // namespace content 85 } // namespace content
89 86
90 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_ 87 #endif // CONTENT_BROWSER_RENDERER_HOST_SANDBOX_IPC_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_sandbox_host_linux.cc ('k') | content/browser/renderer_host/sandbox_ipc_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698