| 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 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 | 1962 |
| 1963 #if defined(OS_WIN) | 1963 #if defined(OS_WIN) |
| 1964 // The cbstext.dll loads as a global GetMessage hook in the browser process | 1964 // The cbstext.dll loads as a global GetMessage hook in the browser process |
| 1965 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a | 1965 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a |
| 1966 // background thread. If the UI thread invokes this API just when it is | 1966 // background thread. If the UI thread invokes this API just when it is |
| 1967 // intercepted the stack is messed up on return from the interceptor | 1967 // intercepted the stack is messed up on return from the interceptor |
| 1968 // which causes random crashes in the browser process. Our hack for now | 1968 // which causes random crashes in the browser process. Our hack for now |
| 1969 // is to not invoke the SetPriorityClass API if the dll is loaded. | 1969 // is to not invoke the SetPriorityClass API if the dll is loaded. |
| 1970 if (GetModuleHandle(L"cbstext.dll")) | 1970 if (GetModuleHandle(L"cbstext.dll")) |
| 1971 return; | 1971 return; |
| 1972 |
| 1973 // Windows Vista+ has a fancy process backgrounding mode that can only be set |
| 1974 // from within the process. So notify the child process of background state. |
| 1975 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); |
| 1976 #else |
| 1977 |
| 1978 // Backgrounding may require elevated privileges not available to renderer |
| 1979 // processes, so control backgrounding from the process host. |
| 1980 child_process_launcher_->SetProcessBackgrounded(backgrounded); |
| 1972 #endif // OS_WIN | 1981 #endif // OS_WIN |
| 1973 | |
| 1974 child_process_launcher_->SetProcessBackgrounded(backgrounded); | |
| 1975 } | 1982 } |
| 1976 | 1983 |
| 1977 void RenderProcessHostImpl::OnProcessLaunched() { | 1984 void RenderProcessHostImpl::OnProcessLaunched() { |
| 1978 // No point doing anything, since this object will be destructed soon. We | 1985 // No point doing anything, since this object will be destructed soon. We |
| 1979 // especially don't want to send the RENDERER_PROCESS_CREATED notification, | 1986 // especially don't want to send the RENDERER_PROCESS_CREATED notification, |
| 1980 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to | 1987 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to |
| 1981 // properly cleanup. | 1988 // properly cleanup. |
| 1982 if (deleting_soon_) | 1989 if (deleting_soon_) |
| 1983 return; | 1990 return; |
| 1984 | 1991 |
| 1985 if (child_process_launcher_) { | 1992 if (child_process_launcher_) { |
| 1986 if (!child_process_launcher_->GetHandle()) { | 1993 if (!child_process_launcher_->GetHandle()) { |
| 1987 OnChannelError(); | 1994 OnChannelError(); |
| 1988 return; | 1995 return; |
| 1989 } | 1996 } |
| 1990 | 1997 |
| 1991 child_process_launcher_->SetProcessBackgrounded(backgrounded_); | 1998 SetBackgrounded(backgrounded_); |
| 1992 } | 1999 } |
| 1993 | 2000 |
| 1994 // NOTE: This needs to be before sending queued messages because | 2001 // NOTE: This needs to be before sending queued messages because |
| 1995 // ExtensionService uses this notification to initialize the renderer process | 2002 // ExtensionService uses this notification to initialize the renderer process |
| 1996 // with state that must be there before any JavaScript executes. | 2003 // with state that must be there before any JavaScript executes. |
| 1997 // | 2004 // |
| 1998 // The queued messages contain such things as "navigate". If this notification | 2005 // The queued messages contain such things as "navigate". If this notification |
| 1999 // was after, we can end up executing JavaScript before the initialization | 2006 // was after, we can end up executing JavaScript before the initialization |
| 2000 // happens. | 2007 // happens. |
| 2001 NotificationService::current()->Notify( | 2008 NotificationService::current()->Notify( |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2096 mojo_activation_required_ = true; | 2103 mojo_activation_required_ = true; |
| 2097 MaybeActivateMojo(); | 2104 MaybeActivateMojo(); |
| 2098 | 2105 |
| 2099 mojo_application_host_->service_provider()->ConnectToService( | 2106 mojo_application_host_->service_provider()->ConnectToService( |
| 2100 mojo::String::From(service_name), | 2107 mojo::String::From(service_name), |
| 2101 std::string(), | 2108 std::string(), |
| 2102 handle.Pass()); | 2109 handle.Pass()); |
| 2103 } | 2110 } |
| 2104 | 2111 |
| 2105 } // namespace content | 2112 } // namespace content |
| OLD | NEW |