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 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 | 2006 |
2007 #if defined(OS_WIN) | 2007 #if defined(OS_WIN) |
2008 // The cbstext.dll loads as a global GetMessage hook in the browser process | 2008 // The cbstext.dll loads as a global GetMessage hook in the browser process |
2009 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a | 2009 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a |
2010 // background thread. If the UI thread invokes this API just when it is | 2010 // background thread. If the UI thread invokes this API just when it is |
2011 // intercepted the stack is messed up on return from the interceptor | 2011 // intercepted the stack is messed up on return from the interceptor |
2012 // which causes random crashes in the browser process. Our hack for now | 2012 // which causes random crashes in the browser process. Our hack for now |
2013 // is to not invoke the SetPriorityClass API if the dll is loaded. | 2013 // is to not invoke the SetPriorityClass API if the dll is loaded. |
2014 if (GetModuleHandle(L"cbstext.dll")) | 2014 if (GetModuleHandle(L"cbstext.dll")) |
2015 return; | 2015 return; |
| 2016 #endif // OS_WIN |
| 2017 |
| 2018 // Notify the child process of background state. |
| 2019 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); |
| 2020 |
| 2021 #if !defined(OS_WIN) |
| 2022 // Backgrounding may require elevated privileges not available to renderer |
| 2023 // processes, so control backgrounding from the process host. |
2016 | 2024 |
2017 // Windows Vista+ has a fancy process backgrounding mode that can only be set | 2025 // Windows Vista+ has a fancy process backgrounding mode that can only be set |
2018 // from within the process. So notify the child process of background state. | 2026 // from within the process. |
2019 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); | |
2020 #else | |
2021 | |
2022 // Backgrounding may require elevated privileges not available to renderer | |
2023 // processes, so control backgrounding from the process host. | |
2024 child_process_launcher_->SetProcessBackgrounded(backgrounded); | 2027 child_process_launcher_->SetProcessBackgrounded(backgrounded); |
2025 #endif // OS_WIN | 2028 #endif // !OS_WIN |
2026 } | 2029 } |
2027 | 2030 |
2028 void RenderProcessHostImpl::OnProcessLaunched() { | 2031 void RenderProcessHostImpl::OnProcessLaunched() { |
2029 // No point doing anything, since this object will be destructed soon. We | 2032 // No point doing anything, since this object will be destructed soon. We |
2030 // especially don't want to send the RENDERER_PROCESS_CREATED notification, | 2033 // especially don't want to send the RENDERER_PROCESS_CREATED notification, |
2031 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to | 2034 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to |
2032 // properly cleanup. | 2035 // properly cleanup. |
2033 if (deleting_soon_) | 2036 if (deleting_soon_) |
2034 return; | 2037 return; |
2035 | 2038 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 void RenderProcessHostImpl::GpuMemoryBufferAllocated( | 2252 void RenderProcessHostImpl::GpuMemoryBufferAllocated( |
2250 IPC::Message* reply, | 2253 IPC::Message* reply, |
2251 const gfx::GpuMemoryBufferHandle& handle) { | 2254 const gfx::GpuMemoryBufferHandle& handle) { |
2252 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2255 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2253 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | 2256 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, |
2254 handle); | 2257 handle); |
2255 Send(reply); | 2258 Send(reply); |
2256 } | 2259 } |
2257 | 2260 |
2258 } // namespace content | 2261 } // namespace content |
OLD | NEW |