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

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

Issue 2350423003: [Tentaive patch for discussion] Add Purge+Suspend metrics as UMA.
Patch Set: Fixed misuse of CanPurgeAndSuspend Created 4 years, 2 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 | « no previous file | chrome/browser/memory/tab_manager.cc » ('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 #ifndef CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 5 #ifndef CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // manually test the system. 220 // manually test the system.
221 void RecordDiscardStatistics(); 221 void RecordDiscardStatistics();
222 222
223 // Record whether an out of memory occured during a recent time interval. This 223 // Record whether an out of memory occured during a recent time interval. This
224 // allows the normalization of low memory statistics versus usage. 224 // allows the normalization of low memory statistics versus usage.
225 void RecordRecentTabDiscard(); 225 void RecordRecentTabDiscard();
226 226
227 // Purges data structures in the browser that can be easily recomputed. 227 // Purges data structures in the browser that can be easily recomputed.
228 void PurgeBrowserMemory(); 228 void PurgeBrowserMemory();
229 229
230 // Records UMA histogram statistics for a renderer purge and suspend.
231 void RecordPurgeAndSuspendMetrics(const base::ProcessHandle& handle);
232
230 // Returns the number of tabs open in all browser instances. 233 // Returns the number of tabs open in all browser instances.
231 int GetTabCount() const; 234 int GetTabCount() const;
232 235
233 // Adds all the stats of the tabs to |stats_list|. 236 // Adds all the stats of the tabs to |stats_list|.
234 void AddTabStats(TabStatsList* stats_list); 237 void AddTabStats(TabStatsList* stats_list);
235 238
236 // Adds all the stats of the tabs in |tab_strip_model| into |stats_list|. 239 // Adds all the stats of the tabs in |tab_strip_model| into |stats_list|.
237 // If |active_model| is true, consider its first tab as being active. 240 // If |active_model| is true, consider its first tab as being active.
238 void AddTabStats(const TabStripModel* model, 241 void AddTabStats(const TabStripModel* model,
239 bool is_app, 242 bool is_app,
240 bool active_model, 243 bool active_model,
241 TabStatsList* stats_list); 244 TabStatsList* stats_list);
242 245
243 // Callback for when |update_timer_| fires. Takes care of executing the tasks 246 // Callback for when |update_timer_| fires. Takes care of executing the tasks
244 // that need to be run periodically (see comment in implementation). 247 // that need to be run periodically (see comment in implementation).
245 void UpdateTimerCallback(); 248 void UpdateTimerCallback();
246 249
250 // Goes through a list of checks to see if a tab is allowed to be purged and
251 // suspended by purge+susend backgrounded tab mechanism.
252 bool CanPurgeAndSuspendBackgroundedTab(int64_t target_web_contents_id) const;
253
247 // Purges and suspends renderers in backgrounded tabs. 254 // Purges and suspends renderers in backgrounded tabs.
248 void PurgeAndSuspendBackgroundedTabs(); 255 void PurgeAndSuspendBackgroundedTabs();
249 256
250 // Does the actual discard by destroying the WebContents in |model| at |index| 257 // Does the actual discard by destroying the WebContents in |model| at |index|
251 // and replacing it by an empty one. Returns the new WebContents or NULL if 258 // and replacing it by an empty one. Returns the new WebContents or NULL if
252 // the operation fails (return value used only in testing). 259 // the operation fails (return value used only in testing).
253 content::WebContents* DiscardWebContentsAt(int index, TabStripModel* model); 260 content::WebContents* DiscardWebContentsAt(int index, TabStripModel* model);
254 261
255 // Called by the memory pressure listener when the memory pressure rises. 262 // Called by the memory pressure listener when the memory pressure rises.
256 void OnMemoryPressure( 263 void OnMemoryPressure(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 386
380 // Weak pointer factory used for posting delayed tasks to task_runner_. 387 // Weak pointer factory used for posting delayed tasks to task_runner_.
381 base::WeakPtrFactory<TabManager> weak_ptr_factory_; 388 base::WeakPtrFactory<TabManager> weak_ptr_factory_;
382 389
383 DISALLOW_COPY_AND_ASSIGN(TabManager); 390 DISALLOW_COPY_AND_ASSIGN(TabManager);
384 }; 391 };
385 392
386 } // namespace memory 393 } // namespace memory
387 394
388 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 395 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/memory/tab_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698