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

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

Issue 2439493002: Reduce usage of FOR_EACH_OBSERVER macro in chrome/browser (Closed)
Patch Set: 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
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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // static 483 // static
484 int64_t TabManager::IdFromWebContents(WebContents* web_contents) { 484 int64_t TabManager::IdFromWebContents(WebContents* web_contents) {
485 return reinterpret_cast<int64_t>(web_contents); 485 return reinterpret_cast<int64_t>(web_contents);
486 } 486 }
487 487
488 /////////////////////////////////////////////////////////////////////////////// 488 ///////////////////////////////////////////////////////////////////////////////
489 // TabManager, private: 489 // TabManager, private:
490 490
491 void TabManager::OnDiscardedStateChange(content::WebContents* contents, 491 void TabManager::OnDiscardedStateChange(content::WebContents* contents,
492 bool is_discarded) { 492 bool is_discarded) {
493 FOR_EACH_OBSERVER(TabManagerObserver, observers_, 493 for (TabManagerObserver& observer : observers_)
494 OnDiscardedStateChange(contents, is_discarded)); 494 observer.OnDiscardedStateChange(contents, is_discarded);
495 } 495 }
496 496
497 void TabManager::OnAutoDiscardableStateChange(content::WebContents* contents, 497 void TabManager::OnAutoDiscardableStateChange(content::WebContents* contents,
498 bool is_auto_discardable) { 498 bool is_auto_discardable) {
499 FOR_EACH_OBSERVER( 499 for (TabManagerObserver& observer : observers_)
500 TabManagerObserver, observers_, 500 observer.OnAutoDiscardableStateChange(contents, is_auto_discardable);
501 OnAutoDiscardableStateChange(contents, is_auto_discardable));
502 } 501 }
503 502
504 // static 503 // static
505 void TabManager::PurgeMemoryAndDiscardTab() { 504 void TabManager::PurgeMemoryAndDiscardTab() {
506 TabManager* manager = g_browser_process->GetTabManager(); 505 TabManager* manager = g_browser_process->GetTabManager();
507 manager->PurgeBrowserMemory(); 506 manager->PurgeBrowserMemory();
508 manager->DiscardTab(); 507 manager->DiscardTab();
509 } 508 }
510 509
511 // static 510 // static
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 // platform. 958 // platform.
960 std::string allow_multiple_discards = variations::GetVariationParamValue( 959 std::string allow_multiple_discards = variations::GetVariationParamValue(
961 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); 960 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards");
962 return (allow_multiple_discards != "true"); 961 return (allow_multiple_discards != "true");
963 #else 962 #else
964 return false; 963 return false;
965 #endif 964 #endif
966 } 965 }
967 966
968 } // namespace memory 967 } // namespace memory
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698