| 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 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 | 1940 |
| 1941 #if defined(OS_WIN) | 1941 #if defined(OS_WIN) |
| 1942 // The cbstext.dll loads as a global GetMessage hook in the browser process | 1942 // The cbstext.dll loads as a global GetMessage hook in the browser process |
| 1943 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a | 1943 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a |
| 1944 // background thread. If the UI thread invokes this API just when it is | 1944 // background thread. If the UI thread invokes this API just when it is |
| 1945 // intercepted the stack is messed up on return from the interceptor | 1945 // intercepted the stack is messed up on return from the interceptor |
| 1946 // which causes random crashes in the browser process. Our hack for now | 1946 // which causes random crashes in the browser process. Our hack for now |
| 1947 // is to not invoke the SetPriorityClass API if the dll is loaded. | 1947 // is to not invoke the SetPriorityClass API if the dll is loaded. |
| 1948 if (GetModuleHandle(L"cbstext.dll")) | 1948 if (GetModuleHandle(L"cbstext.dll")) |
| 1949 return; | 1949 return; |
| 1950 |
| 1951 // Windows Vista+ has a fancy process backgrounding mode that can only be set |
| 1952 // from within the process. So notify the child process of background state. |
| 1953 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); |
| 1954 #else |
| 1955 |
| 1956 // Backgrounding may require elevated privileges not available to renderer |
| 1957 // processes, so control backgrounding from the process host. |
| 1958 child_process_launcher_->SetProcessBackgrounded(backgrounded); |
| 1950 #endif // OS_WIN | 1959 #endif // OS_WIN |
| 1951 | |
| 1952 child_process_launcher_->SetProcessBackgrounded(backgrounded); | |
| 1953 } | 1960 } |
| 1954 | 1961 |
| 1955 void RenderProcessHostImpl::OnProcessLaunched() { | 1962 void RenderProcessHostImpl::OnProcessLaunched() { |
| 1956 // No point doing anything, since this object will be destructed soon. We | 1963 // No point doing anything, since this object will be destructed soon. We |
| 1957 // especially don't want to send the RENDERER_PROCESS_CREATED notification, | 1964 // especially don't want to send the RENDERER_PROCESS_CREATED notification, |
| 1958 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to | 1965 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to |
| 1959 // properly cleanup. | 1966 // properly cleanup. |
| 1960 if (deleting_soon_) | 1967 if (deleting_soon_) |
| 1961 return; | 1968 return; |
| 1962 | 1969 |
| 1963 if (child_process_launcher_) { | 1970 if (child_process_launcher_) { |
| 1964 if (!child_process_launcher_->GetHandle()) { | 1971 if (!child_process_launcher_->GetHandle()) { |
| 1965 OnChannelError(); | 1972 OnChannelError(); |
| 1966 return; | 1973 return; |
| 1967 } | 1974 } |
| 1968 | 1975 |
| 1969 child_process_launcher_->SetProcessBackgrounded(backgrounded_); | 1976 SetBackgrounded(backgrounded_); |
| 1970 } | 1977 } |
| 1971 | 1978 |
| 1972 // NOTE: This needs to be before sending queued messages because | 1979 // NOTE: This needs to be before sending queued messages because |
| 1973 // ExtensionService uses this notification to initialize the renderer process | 1980 // ExtensionService uses this notification to initialize the renderer process |
| 1974 // with state that must be there before any JavaScript executes. | 1981 // with state that must be there before any JavaScript executes. |
| 1975 // | 1982 // |
| 1976 // The queued messages contain such things as "navigate". If this notification | 1983 // The queued messages contain such things as "navigate". If this notification |
| 1977 // was after, we can end up executing JavaScript before the initialization | 1984 // was after, we can end up executing JavaScript before the initialization |
| 1978 // happens. | 1985 // happens. |
| 1979 NotificationService::current()->Notify( | 1986 NotificationService::current()->Notify( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 mojo::ScopedMessagePipeHandle handle) { | 2080 mojo::ScopedMessagePipeHandle handle) { |
| 2074 mojo_activation_required_ = true; | 2081 mojo_activation_required_ = true; |
| 2075 MaybeActivateMojo(); | 2082 MaybeActivateMojo(); |
| 2076 | 2083 |
| 2077 mojo::AllocationScope scope; | 2084 mojo::AllocationScope scope; |
| 2078 mojo_application_host_->service_provider()->ConnectToService(service_name, | 2085 mojo_application_host_->service_provider()->ConnectToService(service_name, |
| 2079 handle.Pass()); | 2086 handle.Pass()); |
| 2080 } | 2087 } |
| 2081 | 2088 |
| 2082 } // namespace content | 2089 } // namespace content |
| OLD | NEW |