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

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

Issue 2335203003: Add metrics to keep track of the tab activate/deactivate cycle (Closed)
Patch Set: Addressed comments Created 4 years, 3 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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 content::WebContents* new_contents, 791 content::WebContents* new_contents,
792 int index, 792 int index,
793 int reason) { 793 int reason) {
794 GetWebContentsData(new_contents)->SetDiscardState(false); 794 GetWebContentsData(new_contents)->SetDiscardState(false);
795 // If |old_contents| is set, that tab has switched from being active to 795 // If |old_contents| is set, that tab has switched from being active to
796 // inactive, so record the time of that transition. 796 // inactive, so record the time of that transition.
797 if (old_contents) 797 if (old_contents)
798 GetWebContentsData(old_contents)->SetLastInactiveTime(NowTicks()); 798 GetWebContentsData(old_contents)->SetLastInactiveTime(NowTicks());
799 } 799 }
800 800
801 void TabManager::TabInsertedAt(content::WebContents* contents, 801 void TabManager::TabInsertedAt(TabStripModel* tab_strip_model,
802 content::WebContents* contents,
802 int index, 803 int index,
803 bool foreground) { 804 bool foreground) {
804 // Only interested in background tabs, as foreground tabs get taken care of by 805 // Only interested in background tabs, as foreground tabs get taken care of by
805 // ActiveTabChanged. 806 // ActiveTabChanged.
806 if (foreground) 807 if (foreground)
807 return; 808 return;
808 809
809 // A new background tab is similar to having a tab switch from being active to 810 // A new background tab is similar to having a tab switch from being active to
810 // inactive. 811 // inactive.
811 GetWebContentsData(contents)->SetLastInactiveTime(NowTicks()); 812 GetWebContentsData(contents)->SetLastInactiveTime(NowTicks());
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 // platform. 936 // platform.
936 std::string allow_multiple_discards = variations::GetVariationParamValue( 937 std::string allow_multiple_discards = variations::GetVariationParamValue(
937 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); 938 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards");
938 return (allow_multiple_discards != "true"); 939 return (allow_multiple_discards != "true");
939 #else 940 #else
940 return false; 941 return false;
941 #endif 942 #endif
942 } 943 }
943 944
944 } // namespace memory 945 } // namespace memory
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698