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/views/sad_tab_view.h" | 5 #include "chrome/browser/ui/views/sad_tab_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 UMA_HISTOGRAM_CUSTOM_COUNTS( | 105 UMA_HISTOGRAM_CUSTOM_COUNTS( |
106 "Tabs.SadTab.CrashCreated", crashed, 1, 1000, 50); | 106 "Tabs.SadTab.CrashCreated", crashed, 1, 1000, 50); |
107 break; | 107 break; |
108 } | 108 } |
109 case chrome::SAD_TAB_KIND_KILLED: { | 109 case chrome::SAD_TAB_KIND_KILLED: { |
110 RecordKillCreated(); | 110 RecordKillCreated(); |
111 LOG(WARNING) << "Tab Killed: " | 111 LOG(WARNING) << "Tab Killed: " |
112 << web_contents->GetURL().GetOrigin().spec(); | 112 << web_contents->GetURL().GetOrigin().spec(); |
113 break; | 113 break; |
114 } | 114 } |
115 case chrome::SAD_TAB_KIND_OOM: { | |
116 static int crashed_due_to_oom = 0; | |
117 crashed_due_to_oom++; | |
118 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
Alexei Svitkine (slow)
2016/07/25 20:39:00
This is UMA_HISTOGRAM_COUNTS_1000().
Will Harris
2016/07/25 20:47:53
Done.
| |
119 "Tabs.SadTab.OomCreated", crashed_due_to_oom, 1, 1000, 50); | |
120 break; | |
121 } | |
115 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
116 case chrome::SAD_TAB_KIND_KILLED_BY_OOM: { | 123 case chrome::SAD_TAB_KIND_KILLED_BY_OOM: { |
117 RecordKillCreated(); | 124 RecordKillCreated(); |
118 RecordKillCreatedOOM(); | 125 RecordKillCreatedOOM(); |
119 const std::string spec = web_contents->GetURL().GetOrigin().spec(); | 126 const std::string spec = web_contents->GetURL().GetOrigin().spec(); |
120 memory::OomMemoryDetails::Log( | 127 memory::OomMemoryDetails::Log( |
121 "Tab OOM-Killed Memory details: " + spec + ", ", base::Closure()); | 128 "Tab OOM-Killed Memory details: " + spec + ", ", base::Closure()); |
122 break; | 129 break; |
123 } | 130 } |
124 #endif | 131 #endif |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 layout->AddView(title_, 2, 1); | 166 layout->AddView(title_, 2, 1); |
160 | 167 |
161 const SkColor text_color = GetNativeTheme()->GetSystemColor( | 168 const SkColor text_color = GetNativeTheme()->GetSystemColor( |
162 ui::NativeTheme::kColorId_LabelDisabledColor); | 169 ui::NativeTheme::kColorId_LabelDisabledColor); |
163 | 170 |
164 int message_id = IDS_SAD_TAB_MESSAGE; | 171 int message_id = IDS_SAD_TAB_MESSAGE; |
165 #if defined(OS_CHROMEOS) | 172 #if defined(OS_CHROMEOS) |
166 if (kind_ == chrome::SAD_TAB_KIND_KILLED_BY_OOM) | 173 if (kind_ == chrome::SAD_TAB_KIND_KILLED_BY_OOM) |
167 message_id = IDS_KILLED_TAB_BY_OOM_MESSAGE; | 174 message_id = IDS_KILLED_TAB_BY_OOM_MESSAGE; |
168 #endif | 175 #endif |
176 if (kind_ == chrome::SAD_TAB_KIND_OOM) | |
177 message_id = IDS_SAD_TAB_OOM_MESSAGE; | |
169 | 178 |
170 message_ = CreateLabel(l10n_util::GetStringUTF16(message_id)); | 179 message_ = CreateLabel(l10n_util::GetStringUTF16(message_id)); |
171 | 180 |
172 message_->SetMultiLine(true); | 181 message_->SetMultiLine(true); |
173 message_->SetEnabledColor(text_color); | 182 message_->SetEnabledColor(text_color); |
174 message_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 183 message_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
175 message_->SetLineHeight(views::kPanelSubVerticalSpacing); | 184 message_->SetLineHeight(views::kPanelSubVerticalSpacing); |
176 | 185 |
177 layout->StartRowWithPadding(0, column_set_id, 0, views::kPanelVertMargin); | 186 layout->StartRowWithPadding(0, column_set_id, 0, views::kPanelVertMargin); |
178 layout->AddView(message_, 2, 1, views::GridLayout::LEADING, | 187 layout->AddView(message_, 2, 1, views::GridLayout::LEADING, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 // These stats should use the same counting approach and bucket size used | 254 // These stats should use the same counting approach and bucket size used |
246 // for tab discard events in memory::OomPriorityManager so they can be | 255 // for tab discard events in memory::OomPriorityManager so they can be |
247 // directly compared. | 256 // directly compared. |
248 switch (kind_) { | 257 switch (kind_) { |
249 case chrome::SAD_TAB_KIND_CRASHED: { | 258 case chrome::SAD_TAB_KIND_CRASHED: { |
250 static int crashed = 0; | 259 static int crashed = 0; |
251 UMA_HISTOGRAM_CUSTOM_COUNTS( | 260 UMA_HISTOGRAM_CUSTOM_COUNTS( |
252 "Tabs.SadTab.CrashDisplayed", ++crashed, 1, 1000, 50); | 261 "Tabs.SadTab.CrashDisplayed", ++crashed, 1, 1000, 50); |
253 break; | 262 break; |
254 } | 263 } |
264 case chrome::SAD_TAB_KIND_OOM: { | |
265 static int crashed_due_to_oom = 0; | |
266 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
267 "Tabs.SadTab.OomDisplayed", ++crashed_due_to_oom, 1, 1000, 50); | |
268 break; | |
269 } | |
255 case chrome::SAD_TAB_KIND_KILLED: | 270 case chrome::SAD_TAB_KIND_KILLED: |
256 RecordKillDisplayed(); | 271 RecordKillDisplayed(); |
257 break; | 272 break; |
258 #if defined(OS_CHROMEOS) | 273 #if defined(OS_CHROMEOS) |
259 case chrome::SAD_TAB_KIND_KILLED_BY_OOM: | 274 case chrome::SAD_TAB_KIND_KILLED_BY_OOM: |
260 RecordKillDisplayed(); | 275 RecordKillDisplayed(); |
261 RecordKillDisplayedOOM(); | 276 RecordKillDisplayedOOM(); |
262 break; | 277 break; |
263 #endif | 278 #endif |
264 } | 279 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 } | 324 } |
310 | 325 |
311 namespace chrome { | 326 namespace chrome { |
312 | 327 |
313 SadTab* SadTab::Create(content::WebContents* web_contents, | 328 SadTab* SadTab::Create(content::WebContents* web_contents, |
314 SadTabKind kind) { | 329 SadTabKind kind) { |
315 return new SadTabView(web_contents, kind); | 330 return new SadTabView(web_contents, kind); |
316 } | 331 } |
317 | 332 |
318 } // namespace chrome | 333 } // namespace chrome |
OLD | NEW |