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

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

Issue 2095413002: TabManagerDelegate: Better prioritize ARC processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes 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 #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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void set_test_tick_clock(base::TickClock* test_tick_clock); 121 void set_test_tick_clock(base::TickClock* test_tick_clock);
122 122
123 // Returns the list of the stats for all renderers. Must be called on the UI 123 // Returns the list of the stats for all renderers. Must be called on the UI
124 // thread. 124 // thread.
125 TabStatsList GetUnsortedTabStats(); 125 TabStatsList GetUnsortedTabStats();
126 126
127 // Add/remove observers. 127 // Add/remove observers.
128 void AddObserver(TabManagerObserver* observer); 128 void AddObserver(TabManagerObserver* observer);
129 void RemoveObserver(TabManagerObserver* observer); 129 void RemoveObserver(TabManagerObserver* observer);
130 130
131 // Returns true if |first| is considered less desirable to be killed than
132 // |second|.
133 static bool CompareTabStats(TabStats first, TabStats second);
Yusuke Sato 2016/07/15 00:55:05 I know this is not your code, but isn't it better
cylee1 2016/07/15 17:31:13 Done.
134
131 private: 135 private:
132 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); 136 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce);
133 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); 137 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications);
134 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); 138 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator);
135 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); 139 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime);
136 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt); 140 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt);
137 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL); 141 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL);
138 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); 142 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage);
139 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); 143 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener);
140 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages); 144 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 241
238 // Returns true if the tab is currently playing audio or has played audio 242 // Returns true if the tab is currently playing audio or has played audio
239 // recently, or if the tab is currently accessing the camera, microphone or 243 // recently, or if the tab is currently accessing the camera, microphone or
240 // mirroring the display. 244 // mirroring the display.
241 bool IsMediaTab(content::WebContents* contents) const; 245 bool IsMediaTab(content::WebContents* contents) const;
242 246
243 // Returns the WebContentsData associated with |contents|. Also takes care of 247 // Returns the WebContentsData associated with |contents|. Also takes care of
244 // creating one if needed. 248 // creating one if needed.
245 WebContentsData* GetWebContentsData(content::WebContents* contents) const; 249 WebContentsData* GetWebContentsData(content::WebContents* contents) const;
246 250
247 // Returns true if |first| is considered less desirable to be killed than
248 // |second|.
249 static bool CompareTabStats(TabStats first, TabStats second);
250
251 // Returns either the system's clock or the test clock. See |test_tick_clock_| 251 // Returns either the system's clock or the test clock. See |test_tick_clock_|
252 // for more details. 252 // for more details.
253 base::TimeTicks NowTicks() const; 253 base::TimeTicks NowTicks() const;
254 254
255 // Dispatches a memory pressure message to a single child process, and 255 // Dispatches a memory pressure message to a single child process, and
256 // schedules another call to itself as long as memory pressure continues. 256 // schedules another call to itself as long as memory pressure continues.
257 void DoChildProcessDispatch(); 257 void DoChildProcessDispatch();
258 258
259 // Implementation of DiscardTab. 259 // Implementation of DiscardTab.
260 bool DiscardTabImpl(); 260 bool DiscardTabImpl();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 // Weak pointer factory used for posting delayed tasks to task_runner_. 349 // Weak pointer factory used for posting delayed tasks to task_runner_.
350 base::WeakPtrFactory<TabManager> weak_ptr_factory_; 350 base::WeakPtrFactory<TabManager> weak_ptr_factory_;
351 351
352 DISALLOW_COPY_AND_ASSIGN(TabManager); 352 DISALLOW_COPY_AND_ASSIGN(TabManager);
353 }; 353 };
354 354
355 } // namespace memory 355 } // namespace memory
356 356
357 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 357 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698