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

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

Issue 621613002: Refactoring: Make IPC::Channel::TakeClientFileDescriptor() a ScopedFD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing Mac build Created 6 years, 2 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
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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 return map; 301 return map;
302 } 302 }
303 303
304 // NOTE: changes to this class need to be reviewed by the security team. 304 // NOTE: changes to this class need to be reviewed by the security team.
305 class RendererSandboxedProcessLauncherDelegate 305 class RendererSandboxedProcessLauncherDelegate
306 : public SandboxedProcessLauncherDelegate { 306 : public SandboxedProcessLauncherDelegate {
307 public: 307 public:
308 explicit RendererSandboxedProcessLauncherDelegate(IPC::ChannelProxy* channel) 308 explicit RendererSandboxedProcessLauncherDelegate(IPC::ChannelProxy* channel)
309 #if defined(OS_POSIX) 309 #if defined(OS_POSIX)
310 : ipc_fd_(channel->TakeClientFileDescriptor()) 310 : ipc_fd_(channel->TakeClientFileDescriptor())
311 #endif // OS_POSIX 311 #endif // OS_POSIX
312 {} 312 {}
313 313
314 virtual ~RendererSandboxedProcessLauncherDelegate() {} 314 virtual ~RendererSandboxedProcessLauncherDelegate() {}
315 315
316 #if defined(OS_WIN) 316 #if defined(OS_WIN)
317 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, 317 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy,
318 bool* success) { 318 bool* success) {
319 AddBaseHandleClosePolicy(policy); 319 AddBaseHandleClosePolicy(policy);
320 GetContentClient()->browser()->PreSpawnRenderer(policy, success); 320 GetContentClient()->browser()->PreSpawnRenderer(policy, success);
321 } 321 }
322 322
323 #elif defined(OS_POSIX) 323 #elif defined(OS_POSIX)
324 virtual bool ShouldUseZygote() override { 324 virtual bool ShouldUseZygote() override {
325 const base::CommandLine& browser_command_line = 325 const base::CommandLine& browser_command_line =
326 *base::CommandLine::ForCurrentProcess(); 326 *base::CommandLine::ForCurrentProcess();
327 base::CommandLine::StringType renderer_prefix = 327 base::CommandLine::StringType renderer_prefix =
328 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); 328 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix);
329 return renderer_prefix.empty(); 329 return renderer_prefix.empty();
330 } 330 }
331 virtual int GetIpcFd() override { 331 virtual base::ScopedFD TakeIpcFd() override {
332 return ipc_fd_; 332 return ipc_fd_.Pass();
333 } 333 }
334 #endif // OS_WIN 334 #endif // OS_WIN
335 335
336 private: 336 private:
337 #if defined(OS_POSIX) 337 #if defined(OS_POSIX)
338 int ipc_fd_; 338 base::ScopedFD ipc_fd_;
339 #endif // OS_POSIX 339 #endif // OS_POSIX
340 }; 340 };
341 341
342 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; 342 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey";
343 343
344 class SessionStorageHolder : public base::SupportsUserData::Data { 344 class SessionStorageHolder : public base::SupportsUserData::Data {
345 public: 345 public:
346 SessionStorageHolder() {} 346 SessionStorageHolder() {}
347 virtual ~SessionStorageHolder() {} 347 virtual ~SessionStorageHolder() {}
348 348
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 2234
2235 void RenderProcessHostImpl::DecrementWorkerRefCount() { 2235 void RenderProcessHostImpl::DecrementWorkerRefCount() {
2236 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2236 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2237 DCHECK_GT(worker_ref_count_, 0); 2237 DCHECK_GT(worker_ref_count_, 0);
2238 --worker_ref_count_; 2238 --worker_ref_count_;
2239 if (worker_ref_count_ == 0) 2239 if (worker_ref_count_ == 0)
2240 Cleanup(); 2240 Cleanup();
2241 } 2241 }
2242 2242
2243 } // namespace content 2243 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698