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

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

Issue 2172013002: Wire up OOM exception to the sad tab page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@memory2
Patch Set: increment outside macro Created 4 years, 5 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
« no previous file with comments | « chrome/browser/ui/sad_tab.cc ('k') | chrome/browser/ui/sad_tab_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/sad_tab_helper.h" 5 #include "chrome/browser/ui/sad_tab_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/browser_shutdown.h" 9 #include "chrome/browser/browser_shutdown.h"
10 #include "chrome/browser/ui/sad_tab.h" 10 #include "chrome/browser/ui/sad_tab.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 12
13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper); 13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper);
14 14
15 namespace { 15 namespace {
16 16
17 chrome::SadTabKind SadTabKindFromTerminationStatus( 17 chrome::SadTabKind SadTabKindFromTerminationStatus(
18 base::TerminationStatus status) { 18 base::TerminationStatus status) {
19 switch (status) { 19 switch (status) {
20 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
21 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: 21 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM:
22 return chrome::SAD_TAB_KIND_KILLED_BY_OOM; 22 return chrome::SAD_TAB_KIND_KILLED_BY_OOM;
23 #endif 23 #endif
24 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: 24 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
25 case base::TERMINATION_STATUS_LAUNCH_FAILED: 25 case base::TERMINATION_STATUS_LAUNCH_FAILED:
26 return chrome::SAD_TAB_KIND_KILLED; 26 return chrome::SAD_TAB_KIND_KILLED;
27 case base::TERMINATION_STATUS_OOM:
28 return chrome::SAD_TAB_KIND_OOM;
27 default: 29 default:
28 return chrome::SAD_TAB_KIND_CRASHED; 30 return chrome::SAD_TAB_KIND_CRASHED;
29 } 31 }
30 } 32 }
31 33
32 } // namespace 34 } // namespace
33 35
34 SadTabHelper::~SadTabHelper() { 36 SadTabHelper::~SadTabHelper() {
35 } 37 }
36 38
(...skipping 20 matching lines...) Expand all
57 59
58 if (chrome::SadTab::ShouldShow(status)) 60 if (chrome::SadTab::ShouldShow(status))
59 InstallSadTab(status); 61 InstallSadTab(status);
60 } 62 }
61 63
62 void SadTabHelper::InstallSadTab(base::TerminationStatus status) { 64 void SadTabHelper::InstallSadTab(base::TerminationStatus status) {
63 sad_tab_.reset(chrome::SadTab::Create( 65 sad_tab_.reset(chrome::SadTab::Create(
64 web_contents(), SadTabKindFromTerminationStatus(status))); 66 web_contents(), SadTabKindFromTerminationStatus(status)));
65 sad_tab_->Show(); 67 sad_tab_->Show();
66 } 68 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sad_tab.cc ('k') | chrome/browser/ui/sad_tab_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698