| 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/browser/ui/hung_plugin_tab_helper.h" | 5 #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/process.h" | 9 #include "base/process.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 std::vector<HANDLE>& data() { return data_; } | 60 std::vector<HANDLE>& data() { return data_; } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 std::vector<HANDLE> data_; | 63 std::vector<HANDLE> data_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(OwnedHandleVector); | 65 DISALLOW_COPY_AND_ASSIGN(OwnedHandleVector); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 void DumpBrowserInBlockingPool() { |
| 69 CrashDumpForHangDebugging(::GetCurrentProcess()); |
| 70 } |
| 71 |
| 68 void DumpRenderersInBlockingPool(OwnedHandleVector* renderer_handles) { | 72 void DumpRenderersInBlockingPool(OwnedHandleVector* renderer_handles) { |
| 69 for (std::vector<HANDLE>::const_iterator iter = | 73 for (std::vector<HANDLE>::const_iterator iter = |
| 70 renderer_handles->data().begin(); | 74 renderer_handles->data().begin(); |
| 71 iter != renderer_handles->data().end(); ++iter) { | 75 iter != renderer_handles->data().end(); ++iter) { |
| 72 CrashDumpIfProcessHandlingPepper(*iter); | 76 CrashDumpForHangDebugging(*iter); |
| 73 } | 77 } |
| 74 } | 78 } |
| 75 | 79 |
| 76 void DumpAndTerminatePluginInBlockingPool( | 80 void DumpAndTerminatePluginInBlockingPool( |
| 77 base::win::ScopedHandle* plugin_handle) { | 81 base::win::ScopedHandle* plugin_handle) { |
| 78 CrashDumpAndTerminateHungChildProcess(plugin_handle->Get()); | 82 CrashDumpAndTerminateHungChildProcess(plugin_handle->Get()); |
| 79 } | 83 } |
| 80 | 84 |
| 81 #endif | 85 #endif |
| 82 | 86 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 HANDLE handle = NULL; | 311 HANDLE handle = NULL; |
| 308 ::DuplicateHandle(current_process, host->GetHandle(), current_process, | 312 ::DuplicateHandle(current_process, host->GetHandle(), current_process, |
| 309 &handle, 0, FALSE, DUPLICATE_SAME_ACCESS); | 313 &handle, 0, FALSE, DUPLICATE_SAME_ACCESS); |
| 310 renderer_handles->data().push_back(handle); | 314 renderer_handles->data().push_back(handle); |
| 311 } | 315 } |
| 312 // If there are a lot of renderer processes, it is likely that we will | 316 // If there are a lot of renderer processes, it is likely that we will |
| 313 // generate too many crash dumps. They might not all be uploaded/recorded | 317 // generate too many crash dumps. They might not all be uploaded/recorded |
| 314 // due to our crash dump uploading restrictions. So we just don't generate | 318 // due to our crash dump uploading restrictions. So we just don't generate |
| 315 // renderer crash dumps in that case. | 319 // renderer crash dumps in that case. |
| 316 if (renderer_handles->data().size() > 0 && | 320 if (renderer_handles->data().size() > 0 && |
| 317 renderer_handles->data().size() < 8) { | 321 renderer_handles->data().size() < 4) { |
| 322 content::BrowserThread::PostBlockingPoolSequencedTask( |
| 323 kDumpChildProcessesSequenceName, FROM_HERE, |
| 324 base::Bind(&DumpBrowserInBlockingPool)); |
| 318 content::BrowserThread::PostBlockingPoolSequencedTask( | 325 content::BrowserThread::PostBlockingPoolSequencedTask( |
| 319 kDumpChildProcessesSequenceName, FROM_HERE, | 326 kDumpChildProcessesSequenceName, FROM_HERE, |
| 320 base::Bind(&DumpRenderersInBlockingPool, | 327 base::Bind(&DumpRenderersInBlockingPool, |
| 321 base::Owned(renderer_handles.release()))); | 328 base::Owned(renderer_handles.release()))); |
| 322 } | 329 } |
| 323 } | 330 } |
| 324 } | 331 } |
| 325 #endif | 332 #endif |
| 326 | 333 |
| 327 PluginStateMap::iterator found = hung_plugins_.find(child_id); | 334 PluginStateMap::iterator found = hung_plugins_.find(child_id); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 state->info_bar = NULL; | 374 state->info_bar = NULL; |
| 368 } | 375 } |
| 369 } | 376 } |
| 370 | 377 |
| 371 InfoBarTabHelper* HungPluginTabHelper::GetInfoBarHelper() { | 378 InfoBarTabHelper* HungPluginTabHelper::GetInfoBarHelper() { |
| 372 TabContents* tab_contents = TabContents::FromWebContents(web_contents()); | 379 TabContents* tab_contents = TabContents::FromWebContents(web_contents()); |
| 373 if (!tab_contents) | 380 if (!tab_contents) |
| 374 return NULL; | 381 return NULL; |
| 375 return tab_contents->infobar_tab_helper(); | 382 return tab_contents->infobar_tab_helper(); |
| 376 } | 383 } |
| OLD | NEW |