| OLD | NEW |
| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ~RendererSandboxedProcessLauncherDelegate() override {} |
| 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 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 base::ScopedFD TakeIpcFd() override { | 331 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } |
| 332 return ipc_fd_.Pass(); | |
| 333 } | |
| 334 #endif // OS_WIN | 332 #endif // OS_WIN |
| 335 | 333 |
| 336 private: | 334 private: |
| 337 #if defined(OS_POSIX) | 335 #if defined(OS_POSIX) |
| 338 base::ScopedFD ipc_fd_; | 336 base::ScopedFD ipc_fd_; |
| 339 #endif // OS_POSIX | 337 #endif // OS_POSIX |
| 340 }; | 338 }; |
| 341 | 339 |
| 342 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; | 340 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; |
| 343 | 341 |
| 344 class SessionStorageHolder : public base::SupportsUserData::Data { | 342 class SessionStorageHolder : public base::SupportsUserData::Data { |
| 345 public: | 343 public: |
| 346 SessionStorageHolder() {} | 344 SessionStorageHolder() {} |
| 347 virtual ~SessionStorageHolder() {} | 345 ~SessionStorageHolder() override {} |
| 348 | 346 |
| 349 void Hold(const SessionStorageNamespaceMap& sessions, int view_route_id) { | 347 void Hold(const SessionStorageNamespaceMap& sessions, int view_route_id) { |
| 350 session_storage_namespaces_awaiting_close_[view_route_id] = sessions; | 348 session_storage_namespaces_awaiting_close_[view_route_id] = sessions; |
| 351 } | 349 } |
| 352 | 350 |
| 353 void Release(int old_route_id) { | 351 void Release(int old_route_id) { |
| 354 session_storage_namespaces_awaiting_close_.erase(old_route_id); | 352 session_storage_namespaces_awaiting_close_.erase(old_route_id); |
| 355 } | 353 } |
| 356 | 354 |
| 357 private: | 355 private: |
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 | 2233 |
| 2236 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 2234 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
| 2237 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2235 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2238 DCHECK_GT(worker_ref_count_, 0); | 2236 DCHECK_GT(worker_ref_count_, 0); |
| 2239 --worker_ref_count_; | 2237 --worker_ref_count_; |
| 2240 if (worker_ref_count_ == 0) | 2238 if (worker_ref_count_ == 0) |
| 2241 Cleanup(); | 2239 Cleanup(); |
| 2242 } | 2240 } |
| 2243 | 2241 |
| 2244 } // namespace content | 2242 } // namespace content |
| OLD | NEW |