Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1447)

Side by Side Diff: chrome/browser/ui/hung_plugin_tab_helper.cc

Issue 1269773002: Cleanup VersionInfo after componentization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/infobars/infobar_service.h" 14 #include "chrome/browser/infobars/infobar_service.h"
15 #include "chrome/common/chrome_version_info.h" 15 #include "chrome/common/channel_info.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "chrome/grit/locale_settings.h" 17 #include "chrome/grit/locale_settings.h"
18 #include "components/infobars/core/confirm_infobar_delegate.h" 18 #include "components/infobars/core/confirm_infobar_delegate.h"
19 #include "components/infobars/core/infobar.h" 19 #include "components/infobars/core/infobar.h"
20 #include "components/version_info/version_info.h"
20 #include "content/public/browser/browser_child_process_host_iterator.h" 21 #include "content/public/browser/browser_child_process_host_iterator.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/child_process_data.h" 23 #include "content/public/browser/child_process_data.h"
23 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/plugin_service.h" 26 #include "content/public/browser/plugin_service.h"
26 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
27 #include "content/public/common/process_type.h" 28 #include "content/public/common/process_type.h"
28 #include "content/public/common/result_codes.h" 29 #include "content/public/common/result_codes.h"
29 #include "grit/theme_resources.h" 30 #include "grit/theme_resources.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 349 }
349 } 350 }
350 } 351 }
351 352
352 void HungPluginTabHelper::KillPlugin(int child_id) { 353 void HungPluginTabHelper::KillPlugin(int child_id) {
353 #if defined(OS_WIN) 354 #if defined(OS_WIN)
354 // Dump renderers that are sending or receiving pepper messages, in order to 355 // Dump renderers that are sending or receiving pepper messages, in order to
355 // diagnose inter-process deadlocks. 356 // diagnose inter-process deadlocks.
356 // Only do that on the Canary channel, for 20% of pepper plugin hangs. 357 // Only do that on the Canary channel, for 20% of pepper plugin hangs.
357 if (base::RandInt(0, 100) < 20) { 358 if (base::RandInt(0, 100) < 20) {
358 version_info::Channel channel = chrome::VersionInfo::GetChannel(); 359 version_info::Channel channel = chrome::GetChannel();
359 if (channel == version_info::Channel::CANARY) { 360 if (channel == version_info::Channel::CANARY) {
360 scoped_ptr<OwnedHandleVector> renderer_handles(new OwnedHandleVector); 361 scoped_ptr<OwnedHandleVector> renderer_handles(new OwnedHandleVector);
361 HANDLE current_process = ::GetCurrentProcess(); 362 HANDLE current_process = ::GetCurrentProcess();
362 content::RenderProcessHost::iterator renderer_iter = 363 content::RenderProcessHost::iterator renderer_iter =
363 content::RenderProcessHost::AllHostsIterator(); 364 content::RenderProcessHost::AllHostsIterator();
364 for (; !renderer_iter.IsAtEnd(); renderer_iter.Advance()) { 365 for (; !renderer_iter.IsAtEnd(); renderer_iter.Advance()) {
365 content::RenderProcessHost* host = renderer_iter.GetCurrentValue(); 366 content::RenderProcessHost* host = renderer_iter.GetCurrentValue();
366 HANDLE handle = NULL; 367 HANDLE handle = NULL;
367 ::DuplicateHandle(current_process, host->GetHandle(), current_process, 368 ::DuplicateHandle(current_process, host->GetHandle(), current_process,
368 &handle, 0, FALSE, DUPLICATE_SAME_ACCESS); 369 &handle, 0, FALSE, DUPLICATE_SAME_ACCESS);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 417 }
417 418
418 void HungPluginTabHelper::CloseBar(PluginState* state) { 419 void HungPluginTabHelper::CloseBar(PluginState* state) {
419 InfoBarService* infobar_service = 420 InfoBarService* infobar_service =
420 InfoBarService::FromWebContents(web_contents()); 421 InfoBarService::FromWebContents(web_contents());
421 if (infobar_service && state->infobar) { 422 if (infobar_service && state->infobar) {
422 infobar_service->RemoveInfoBar(state->infobar); 423 infobar_service->RemoveInfoBar(state->infobar);
423 state->infobar = NULL; 424 state->infobar = NULL;
424 } 425 }
425 } 426 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/extension_message_bubble_factory.cc ('k') | chrome/browser/ui/panels/panel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698