| 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 #include "chrome/renderer/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // processed (because that message loop is stuck in V8). | 155 // processed (because that message loop is stuck in V8). |
| 156 // | 156 // |
| 157 // One could make the browser SIGKILL the renderers, but that leaves open a | 157 // One could make the browser SIGKILL the renderers, but that leaves open a |
| 158 // large window where a browser failure (or a user, manually terminating | 158 // large window where a browser failure (or a user, manually terminating |
| 159 // the browser because "it's stuck") will leave behind a process eating all | 159 // the browser because "it's stuck") will leave behind a process eating all |
| 160 // the CPU. | 160 // the CPU. |
| 161 // | 161 // |
| 162 // So, we install a filter on the channel so that we can process this event | 162 // So, we install a filter on the channel so that we can process this event |
| 163 // here and kill the process. | 163 // here and kill the process. |
| 164 | 164 |
| 165 _exit(0); | 165 if (CommandLine::ForCurrentProcess()-> |
| 166 HasSwitch(switches::kEnableRendererCleanExit)) |
| 167 alarm(30); |
| 168 else |
| 169 _exit(0); |
| 166 } | 170 } |
| 167 }; | 171 }; |
| 168 #endif // OS_POSIX | 172 #endif // OS_POSIX |
| 169 | 173 |
| 170 } // namespace | 174 } // namespace |
| 171 | 175 |
| 172 bool ChromeRenderProcessObserver::is_incognito_process_ = false; | 176 bool ChromeRenderProcessObserver::is_incognito_process_ = false; |
| 173 | 177 |
| 174 ChromeRenderProcessObserver::ChromeRenderProcessObserver( | 178 ChromeRenderProcessObserver::ChromeRenderProcessObserver( |
| 175 chrome::ChromeContentRendererClient* client) | 179 chrome::ChromeContentRendererClient* client) |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 if (clear_cache_pending_) { | 378 if (clear_cache_pending_) { |
| 375 clear_cache_pending_ = false; | 379 clear_cache_pending_ = false; |
| 376 WebCache::clear(); | 380 WebCache::clear(); |
| 377 } | 381 } |
| 378 } | 382 } |
| 379 | 383 |
| 380 const RendererContentSettingRules* | 384 const RendererContentSettingRules* |
| 381 ChromeRenderProcessObserver::content_setting_rules() const { | 385 ChromeRenderProcessObserver::content_setting_rules() const { |
| 382 return &content_setting_rules_; | 386 return &content_setting_rules_; |
| 383 } | 387 } |
| OLD | NEW |