| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 #include "third_party/WebKit/public/public_features.h" | 191 #include "third_party/WebKit/public/public_features.h" |
| 192 #include "third_party/skia/include/core/SkBitmap.h" | 192 #include "third_party/skia/include/core/SkBitmap.h" |
| 193 #include "ui/base/ui_base_switches.h" | 193 #include "ui/base/ui_base_switches.h" |
| 194 #include "ui/display/display_switches.h" | 194 #include "ui/display/display_switches.h" |
| 195 #include "ui/gfx/switches.h" | 195 #include "ui/gfx/switches.h" |
| 196 #include "ui/gl/gl_switches.h" | 196 #include "ui/gl/gl_switches.h" |
| 197 #include "ui/gl/gpu_switching_manager.h" | 197 #include "ui/gl/gpu_switching_manager.h" |
| 198 #include "ui/native_theme/native_theme_switches.h" | 198 #include "ui/native_theme/native_theme_switches.h" |
| 199 | 199 |
| 200 #if defined(OS_ANDROID) | 200 #if defined(OS_ANDROID) |
| 201 #include "content/browser/android/child_process_launcher_android.h" | |
| 202 #include "content/browser/screen_orientation/screen_orientation_listener_android
.h" | 201 #include "content/browser/screen_orientation/screen_orientation_listener_android
.h" |
| 203 #include "content/public/browser/android/java_interfaces.h" | 202 #include "content/public/browser/android/java_interfaces.h" |
| 204 #include "ipc/ipc_sync_channel.h" | 203 #include "ipc/ipc_sync_channel.h" |
| 205 #include "media/audio/android/audio_manager_android.h" | 204 #include "media/audio/android/audio_manager_android.h" |
| 206 #endif | 205 #endif |
| 207 | 206 |
| 208 #if defined(OS_WIN) | 207 #if defined(OS_WIN) |
| 209 #include "base/win/scoped_com_initializer.h" | 208 #include "base/win/scoped_com_initializer.h" |
| 210 #include "base/win/windows_version.h" | 209 #include "base/win/windows_version.h" |
| 211 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" | 210 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" |
| (...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 bool RenderProcessHostImpl::IsReady() const { | 1931 bool RenderProcessHostImpl::IsReady() const { |
| 1933 // The process launch result (that sets GetHandle()) and the channel | 1932 // The process launch result (that sets GetHandle()) and the channel |
| 1934 // connection (that sets channel_connected_) can happen in either order. | 1933 // connection (that sets channel_connected_) can happen in either order. |
| 1935 return GetHandle() && channel_connected_; | 1934 return GetHandle() && channel_connected_; |
| 1936 } | 1935 } |
| 1937 | 1936 |
| 1938 bool RenderProcessHostImpl::Shutdown(int exit_code, bool wait) { | 1937 bool RenderProcessHostImpl::Shutdown(int exit_code, bool wait) { |
| 1939 if (run_renderer_in_process()) | 1938 if (run_renderer_in_process()) |
| 1940 return false; // Single process mode never shuts down the renderer. | 1939 return false; // Single process mode never shuts down the renderer. |
| 1941 | 1940 |
| 1942 #if defined(OS_ANDROID) | 1941 if (!child_process_launcher_.get()) |
| 1943 // Android requires a different approach for killing. | |
| 1944 StopChildProcess(GetHandle()); | |
| 1945 return true; | |
| 1946 #else | |
| 1947 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) | |
| 1948 return false; | 1942 return false; |
| 1949 | 1943 |
| 1950 return child_process_launcher_->GetProcess().Terminate(exit_code, wait); | 1944 return child_process_launcher_->Terminate(exit_code, wait); |
| 1951 #endif | |
| 1952 } | 1945 } |
| 1953 | 1946 |
| 1954 bool RenderProcessHostImpl::FastShutdownIfPossible() { | 1947 bool RenderProcessHostImpl::FastShutdownIfPossible() { |
| 1955 if (run_renderer_in_process()) | 1948 if (run_renderer_in_process()) |
| 1956 return false; // Single process mode never shuts down the renderer. | 1949 return false; // Single process mode never shuts down the renderer. |
| 1957 | 1950 |
| 1958 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting() || | 1951 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting() || |
| 1959 !GetHandle()) | 1952 !GetHandle()) |
| 1960 return false; // Render process hasn't started or is probably crashed. | 1953 return false; // Render process hasn't started or is probably crashed. |
| 1961 | 1954 |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3031 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3024 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3032 | 3025 |
| 3033 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3026 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
| 3034 // Capture the error message in a crash key value. | 3027 // Capture the error message in a crash key value. |
| 3035 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3028 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
| 3036 bad_message::ReceivedBadMessage(render_process_id, | 3029 bad_message::ReceivedBadMessage(render_process_id, |
| 3037 bad_message::RPH_MOJO_PROCESS_ERROR); | 3030 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3038 } | 3031 } |
| 3039 | 3032 |
| 3040 } // namespace content | 3033 } // namespace content |
| OLD | NEW |