Chromium Code Reviews| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 #include "storage/browser/fileapi/sandbox_file_system_backend.h" | 142 #include "storage/browser/fileapi/sandbox_file_system_backend.h" |
| 143 #include "third_party/skia/include/core/SkBitmap.h" | 143 #include "third_party/skia/include/core/SkBitmap.h" |
| 144 #include "ui/base/ui_base_switches.h" | 144 #include "ui/base/ui_base_switches.h" |
| 145 #include "ui/events/event_switches.h" | 145 #include "ui/events/event_switches.h" |
| 146 #include "ui/gfx/switches.h" | 146 #include "ui/gfx/switches.h" |
| 147 #include "ui/gl/gl_switches.h" | 147 #include "ui/gl/gl_switches.h" |
| 148 #include "ui/gl/gpu_switching_manager.h" | 148 #include "ui/gl/gpu_switching_manager.h" |
| 149 #include "ui/native_theme/native_theme_switches.h" | 149 #include "ui/native_theme/native_theme_switches.h" |
| 150 | 150 |
| 151 #if defined(OS_ANDROID) | 151 #if defined(OS_ANDROID) |
| 152 #include "content/browser/android/child_process_launcher_android.h" | |
| 152 #include "content/browser/media/android/browser_demuxer_android.h" | 153 #include "content/browser/media/android/browser_demuxer_android.h" |
| 153 #include "content/browser/screen_orientation/screen_orientation_message_filter_a ndroid.h" | 154 #include "content/browser/screen_orientation/screen_orientation_message_filter_a ndroid.h" |
| 154 #endif | 155 #endif |
| 155 | 156 |
| 156 #if defined(OS_WIN) | 157 #if defined(OS_WIN) |
| 157 #include "base/win/scoped_com_initializer.h" | 158 #include "base/win/scoped_com_initializer.h" |
| 158 #include "content/common/font_cache_dispatcher_win.h" | 159 #include "content/common/font_cache_dispatcher_win.h" |
| 159 #include "content/common/sandbox_win.h" | 160 #include "content/common/sandbox_win.h" |
| 160 #include "ui/gfx/win/dpi.h" | 161 #include "ui/gfx/win/dpi.h" |
| 161 #endif | 162 #endif |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 if (command_line->HasSwitch(switches::kDisableKillAfterBadIPC)) | 958 if (command_line->HasSwitch(switches::kDisableKillAfterBadIPC)) |
| 958 return; | 959 return; |
| 959 | 960 |
| 960 if (run_renderer_in_process()) { | 961 if (run_renderer_in_process()) { |
| 961 // In single process mode it is better if we don't suicide but just | 962 // In single process mode it is better if we don't suicide but just |
| 962 // crash. | 963 // crash. |
| 963 CHECK(false); | 964 CHECK(false); |
| 964 } | 965 } |
| 965 // We kill the renderer but don't include a NOTREACHED, because we want the | 966 // We kill the renderer but don't include a NOTREACHED, because we want the |
| 966 // browser to try to survive when it gets illegal messages from the renderer. | 967 // browser to try to survive when it gets illegal messages from the renderer. |
| 967 base::KillProcess(GetHandle(), RESULT_CODE_KILLED_BAD_MESSAGE, | 968 FastShutdown(RESULT_CODE_KILLED_BAD_MESSAGE, false); |
| 968 false); | |
| 969 } | 969 } |
| 970 | 970 |
| 971 void RenderProcessHostImpl::WidgetRestored() { | 971 void RenderProcessHostImpl::WidgetRestored() { |
| 972 // Verify we were properly backgrounded. | 972 // Verify we were properly backgrounded. |
| 973 DCHECK_EQ(backgrounded_, (visible_widgets_ == 0)); | 973 DCHECK_EQ(backgrounded_, (visible_widgets_ == 0)); |
| 974 visible_widgets_++; | 974 visible_widgets_++; |
| 975 SetBackgrounded(false); | 975 SetBackgrounded(false); |
| 976 } | 976 } |
| 977 | 977 |
| 978 void RenderProcessHostImpl::WidgetHidden() { | 978 void RenderProcessHostImpl::WidgetHidden() { |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 // Set this before ProcessDied() so observers can tell if the render process | 1335 // Set this before ProcessDied() so observers can tell if the render process |
| 1336 // died due to fast shutdown versus another cause. | 1336 // died due to fast shutdown versus another cause. |
| 1337 fast_shutdown_started_ = true; | 1337 fast_shutdown_started_ = true; |
| 1338 | 1338 |
| 1339 ProcessDied(false /* already_dead */); | 1339 ProcessDied(false /* already_dead */); |
| 1340 return true; | 1340 return true; |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 bool RenderProcessHostImpl::FastShutdown(int exit_code, bool wait) { | |
| 1344 if (run_renderer_in_process()) | |
| 1345 return false; // Single process mode never shutdown the renderer. | |
|
Charlie Reis
2014/12/01 19:44:09
nit: shutdown -> shuts down
Jaekyun Seok (inactive)
2014/12/02 00:50:38
Done.
| |
| 1346 | |
| 1347 #if defined(OS_ANDROID) | |
|
no sievers
2014/12/01 21:32:13
I'm still confused why we need an ifdef here.
Why
Jaekyun Seok (inactive)
2014/12/02 00:50:38
I wanted not to change any execution flow on non-a
| |
| 1348 // Android requires a different approach for killing. | |
| 1349 StopChildProcess(GetHandle()); | |
| 1350 return true; | |
| 1351 #else | |
| 1352 return base::KillProcess(GetHandle(), exit_code, wait); | |
| 1353 #endif | |
| 1354 } | |
| 1355 | |
| 1343 void RenderProcessHostImpl::DumpHandles() { | 1356 void RenderProcessHostImpl::DumpHandles() { |
| 1344 #if defined(OS_WIN) | 1357 #if defined(OS_WIN) |
| 1345 Send(new ChildProcessMsg_DumpHandles()); | 1358 Send(new ChildProcessMsg_DumpHandles()); |
| 1346 #else | 1359 #else |
| 1347 NOTIMPLEMENTED(); | 1360 NOTIMPLEMENTED(); |
| 1348 #endif | 1361 #endif |
| 1349 } | 1362 } |
| 1350 | 1363 |
| 1351 bool RenderProcessHostImpl::Send(IPC::Message* msg) { | 1364 bool RenderProcessHostImpl::Send(IPC::Message* msg) { |
| 1352 TRACE_EVENT0("renderer_host", "RenderProcessHostImpl::Send"); | 1365 TRACE_EVENT0("renderer_host", "RenderProcessHostImpl::Send"); |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2248 | 2261 |
| 2249 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 2262 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
| 2250 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2263 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2251 DCHECK_GT(worker_ref_count_, 0); | 2264 DCHECK_GT(worker_ref_count_, 0); |
| 2252 --worker_ref_count_; | 2265 --worker_ref_count_; |
| 2253 if (worker_ref_count_ == 0) | 2266 if (worker_ref_count_ == 0) |
| 2254 Cleanup(); | 2267 Cleanup(); |
| 2255 } | 2268 } |
| 2256 | 2269 |
| 2257 } // namespace content | 2270 } // namespace content |
| OLD | NEW |