| 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/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    50 #include "components/variations/variations_associated_data.h" |    50 #include "components/variations/variations_associated_data.h" | 
|    51 #include "content/public/browser/browser_thread.h" |    51 #include "content/public/browser/browser_thread.h" | 
|    52 #include "content/public/browser/memory_pressure_controller.h" |    52 #include "content/public/browser/memory_pressure_controller.h" | 
|    53 #include "content/public/browser/navigation_controller.h" |    53 #include "content/public/browser/navigation_controller.h" | 
|    54 #include "content/public/browser/render_process_host.h" |    54 #include "content/public/browser/render_process_host.h" | 
|    55 #include "content/public/browser/web_contents.h" |    55 #include "content/public/browser/web_contents.h" | 
|    56 #include "content/public/common/page_importance_signals.h" |    56 #include "content/public/common/page_importance_signals.h" | 
|    57  |    57  | 
|    58 #if defined(OS_CHROMEOS) |    58 #if defined(OS_CHROMEOS) | 
|    59 #include "ash/multi_profile_uma.h" |    59 #include "ash/multi_profile_uma.h" | 
|    60 #include "ash/wm_shell.h" |    60 #include "ash/shell_port.h" | 
|    61 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" |    61 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" | 
|    62 #include "components/user_manager/user_manager.h" |    62 #include "components/user_manager/user_manager.h" | 
|    63 #endif |    63 #endif | 
|    64  |    64  | 
|    65 using base::TimeDelta; |    65 using base::TimeDelta; | 
|    66 using base::TimeTicks; |    66 using base::TimeTicks; | 
|    67 using content::BrowserThread; |    67 using content::BrowserThread; | 
|    68 using content::WebContents; |    68 using content::WebContents; | 
|    69  |    69  | 
|    70 namespace memory { |    70 namespace memory { | 
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   570  |   570  | 
|   571 void TabManager::RecordDiscardStatistics() { |   571 void TabManager::RecordDiscardStatistics() { | 
|   572   discard_count_++; |   572   discard_count_++; | 
|   573  |   573  | 
|   574   // TODO(jamescook): Maybe incorporate extension count? |   574   // TODO(jamescook): Maybe incorporate extension count? | 
|   575   UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.Discard.TabCount", GetTabCount(), 1, 100, |   575   UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.Discard.TabCount", GetTabCount(), 1, 100, | 
|   576                               50); |   576                               50); | 
|   577 #if defined(OS_CHROMEOS) |   577 #if defined(OS_CHROMEOS) | 
|   578   // Record the discarded tab in relation to the amount of simultaneously |   578   // Record the discarded tab in relation to the amount of simultaneously | 
|   579   // logged in users. |   579   // logged in users. | 
|   580   if (ash::WmShell::HasInstance()) { |   580   if (ash::ShellPort::HasInstance()) { | 
|   581     ash::MultiProfileUMA::RecordDiscardedTab( |   581     ash::MultiProfileUMA::RecordDiscardedTab( | 
|   582         user_manager::UserManager::Get()->GetLoggedInUsers().size()); |   582         user_manager::UserManager::Get()->GetLoggedInUsers().size()); | 
|   583   } |   583   } | 
|   584 #endif |   584 #endif | 
|   585   // TODO(jamescook): If the time stats prove too noisy, then divide up users |   585   // TODO(jamescook): If the time stats prove too noisy, then divide up users | 
|   586   // based on how heavily they use Chrome using tab count as a proxy. |   586   // based on how heavily they use Chrome using tab count as a proxy. | 
|   587   // Bin into <= 1, <= 2, <= 4, <= 8, etc. |   587   // Bin into <= 1, <= 2, <= 4, <= 8, etc. | 
|   588   if (last_discard_time_.is_null()) { |   588   if (last_discard_time_.is_null()) { | 
|   589     // This is the first discard this session. |   589     // This is the first discard this session. | 
|   590     TimeDelta interval = NowTicks() - start_time_; |   590     TimeDelta interval = NowTicks() - start_time_; | 
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1011   // platform. |  1011   // platform. | 
|  1012   std::string allow_multiple_discards = variations::GetVariationParamValue( |  1012   std::string allow_multiple_discards = variations::GetVariationParamValue( | 
|  1013       features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); |  1013       features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); | 
|  1014   return (allow_multiple_discards != "true"); |  1014   return (allow_multiple_discards != "true"); | 
|  1015 #else |  1015 #else | 
|  1016   return false; |  1016   return false; | 
|  1017 #endif |  1017 #endif | 
|  1018 } |  1018 } | 
|  1019  |  1019  | 
|  1020 }  // namespace memory |  1020 }  // namespace memory | 
| OLD | NEW |