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

Side by Side Diff: chrome/browser/memory/tab_manager.cc

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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
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/memory/tab_manager.h" 5 #include "chrome/browser/memory/tab_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "components/variations/variations_associated_data.h" 47 #include "components/variations/variations_associated_data.h"
48 #include "content/public/browser/browser_thread.h" 48 #include "content/public/browser/browser_thread.h"
49 #include "content/public/browser/memory_pressure_controller.h" 49 #include "content/public/browser/memory_pressure_controller.h"
50 #include "content/public/browser/navigation_controller.h" 50 #include "content/public/browser/navigation_controller.h"
51 #include "content/public/browser/render_process_host.h" 51 #include "content/public/browser/render_process_host.h"
52 #include "content/public/browser/web_contents.h" 52 #include "content/public/browser/web_contents.h"
53 #include "content/public/common/page_importance_signals.h" 53 #include "content/public/common/page_importance_signals.h"
54 54
55 #if defined(OS_CHROMEOS) 55 #if defined(OS_CHROMEOS)
56 #include "ash/common/session/session_state_delegate.h" 56 #include "ash/common/session/session_state_delegate.h"
57 #include "ash/common/wm_shell.h"
57 #include "ash/multi_profile_uma.h" 58 #include "ash/multi_profile_uma.h"
58 #include "ash/shell.h"
59 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" 59 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h"
60 #endif 60 #endif
61 61
62 using base::TimeDelta; 62 using base::TimeDelta;
63 using base::TimeTicks; 63 using base::TimeTicks;
64 using content::BrowserThread; 64 using content::BrowserThread;
65 using content::WebContents; 65 using content::WebContents;
66 66
67 namespace memory { 67 namespace memory {
68 namespace { 68 namespace {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 void TabManager::RecordDiscardStatistics() { 378 void TabManager::RecordDiscardStatistics() {
379 discard_count_++; 379 discard_count_++;
380 380
381 // TODO(jamescook): Maybe incorporate extension count? 381 // TODO(jamescook): Maybe incorporate extension count?
382 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.Discard.TabCount", GetTabCount(), 1, 100, 382 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.Discard.TabCount", GetTabCount(), 1, 100,
383 50); 383 50);
384 #if defined(OS_CHROMEOS) 384 #if defined(OS_CHROMEOS)
385 // Record the discarded tab in relation to the amount of simultaneously 385 // Record the discarded tab in relation to the amount of simultaneously
386 // logged in users. 386 // logged in users.
387 if (ash::Shell::HasInstance()) { 387 if (ash::WmShell::HasInstance()) {
388 ash::MultiProfileUMA::RecordDiscardedTab(ash::Shell::GetInstance() 388 ash::MultiProfileUMA::RecordDiscardedTab(ash::WmShell::Get()
389 ->session_state_delegate() 389 ->GetSessionStateDelegate()
390 ->NumberOfLoggedInUsers()); 390 ->NumberOfLoggedInUsers());
391 } 391 }
392 #endif 392 #endif
393 // TODO(jamescook): If the time stats prove too noisy, then divide up users 393 // TODO(jamescook): If the time stats prove too noisy, then divide up users
394 // based on how heavily they use Chrome using tab count as a proxy. 394 // based on how heavily they use Chrome using tab count as a proxy.
395 // Bin into <= 1, <= 2, <= 4, <= 8, etc. 395 // Bin into <= 1, <= 2, <= 4, <= 8, etc.
396 if (last_discard_time_.is_null()) { 396 if (last_discard_time_.is_null()) {
397 // This is the first discard this session. 397 // This is the first discard this session.
398 TimeDelta interval = NowTicks() - start_time_; 398 TimeDelta interval = NowTicks() - start_time_;
399 int interval_seconds = static_cast<int>(interval.InSeconds()); 399 int interval_seconds = static_cast<int>(interval.InSeconds());
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 } 884 }
885 } else { 885 } else {
886 // The code here can only be tested under a full browser test. 886 // The code here can only be tested under a full browser test.
887 AddTabStats(&stats_list); 887 AddTabStats(&stats_list);
888 } 888 }
889 889
890 return stats_list; 890 return stats_list;
891 } 891 }
892 892
893 } // namespace memory 893 } // namespace memory
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698