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

Side by Side Diff: content/browser/renderer_host/render_sandbox_host_linux.cc

Issue 12918004: mmap the opened file descriptor in the renderer process, close the fd in the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 (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 <fcntl.h> 7 #include <fcntl.h>
8 #include <fontconfig/fontconfig.h> 8 #include <fontconfig/fontconfig.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <sys/poll.h> 10 #include <sys/poll.h>
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return; 216 return;
217 const int result_fd = open(paths_[index]->c_str(), O_RDONLY); 217 const int result_fd = open(paths_[index]->c_str(), O_RDONLY);
218 218
219 Pickle reply; 219 Pickle reply;
220 if (result_fd == -1) { 220 if (result_fd == -1) {
221 reply.WriteBool(false); 221 reply.WriteBool(false);
222 } else { 222 } else {
223 reply.WriteBool(true); 223 reply.WriteBool(true);
224 } 224 }
225 225
226 // The receiver will have its own access to the file, so we will close it
227 // after this send.
226 SendRendererReply(fds, reply, result_fd); 228 SendRendererReply(fds, reply, result_fd);
229
230 if (result_fd >= 0) {
231 DCHECK(!HANDLE_EINTR(close(result_fd)));
piman 2013/03/18 19:49:14 I'm not the biggest fan of side-effects inside of
reed1 2013/03/18 20:15:41 Done.
232 }
227 } 233 }
228 234
229 void HandleGetFontFamilyForChars(int fd, const Pickle& pickle, 235 void HandleGetFontFamilyForChars(int fd, const Pickle& pickle,
230 PickleIterator iter, 236 PickleIterator iter,
231 std::vector<int>& fds) { 237 std::vector<int>& fds) {
232 // The other side of this call is 238 // The other side of this call is
233 // chrome/renderer/renderer_sandbox_support_linux.cc 239 // chrome/renderer/renderer_sandbox_support_linux.cc
234 240
235 int num_chars; 241 int num_chars;
236 if (!pickle.ReadInt(&iter, &num_chars)) 242 if (!pickle.ReadInt(&iter, &num_chars))
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 RenderSandboxHostLinux::~RenderSandboxHostLinux() { 733 RenderSandboxHostLinux::~RenderSandboxHostLinux() {
728 if (initialized_) { 734 if (initialized_) {
729 if (HANDLE_EINTR(close(renderer_socket_)) < 0) 735 if (HANDLE_EINTR(close(renderer_socket_)) < 0)
730 PLOG(ERROR) << "close"; 736 PLOG(ERROR) << "close";
731 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0) 737 if (HANDLE_EINTR(close(childs_lifeline_fd_)) < 0)
732 PLOG(ERROR) << "close"; 738 PLOG(ERROR) << "close";
733 } 739 }
734 } 740 }
735 741
736 } // namespace content 742 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/font_config_ipc_linux.cc » ('j') | content/common/font_config_ipc_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698