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

Side by Side Diff: content/browser/appcache/appcache_host.cc

Issue 2422923002: Reduce usage of FOR_EACH_OBSERVER macro in content/browser (Closed)
Patch Set: skip cases in 2418143004 and 2418373002 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/appcache/appcache_host.h" 5 #include "content/browser/appcache/appcache_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/browser/appcache/appcache.h" 10 #include "content/browser/appcache/appcache.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 storage_(service->storage()), 55 storage_(service->storage()),
56 pending_callback_param_(NULL), 56 pending_callback_param_(NULL),
57 main_resource_was_namespace_entry_(false), 57 main_resource_was_namespace_entry_(false),
58 main_resource_blocked_(false), 58 main_resource_blocked_(false),
59 associated_cache_info_pending_(false) { 59 associated_cache_info_pending_(false) {
60 service_->AddObserver(this); 60 service_->AddObserver(this);
61 } 61 }
62 62
63 AppCacheHost::~AppCacheHost() { 63 AppCacheHost::~AppCacheHost() {
64 service_->RemoveObserver(this); 64 service_->RemoveObserver(this);
65 FOR_EACH_OBSERVER(Observer, observers_, OnDestructionImminent(this)); 65 for (auto& observer : observers_)
66 observer.OnDestructionImminent(this);
66 if (associated_cache_.get()) 67 if (associated_cache_.get())
67 associated_cache_->UnassociateHost(this); 68 associated_cache_->UnassociateHost(this);
68 if (group_being_updated_.get()) 69 if (group_being_updated_.get())
69 group_being_updated_->RemoveUpdateObserver(this); 70 group_being_updated_->RemoveUpdateObserver(this);
70 storage()->CancelDelegateCallbacks(this); 71 storage()->CancelDelegateCallbacks(this);
71 if (service()->quota_manager_proxy() && !origin_in_use_.is_empty()) 72 if (service()->quota_manager_proxy() && !origin_in_use_.is_empty())
72 service()->quota_manager_proxy()->NotifyOriginNoLongerInUse(origin_in_use_); 73 service()->quota_manager_proxy()->NotifyOriginNoLongerInUse(origin_in_use_);
73 } 74 }
74 75
75 void AppCacheHost::AddObserver(Observer* observer) { 76 void AppCacheHost::AddObserver(Observer* observer) {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 447 }
447 448
448 // Respond to pending callbacks now that we have a selection. 449 // Respond to pending callbacks now that we have a selection.
449 if (!pending_get_status_callback_.is_null()) 450 if (!pending_get_status_callback_.is_null())
450 DoPendingGetStatus(); 451 DoPendingGetStatus();
451 else if (!pending_start_update_callback_.is_null()) 452 else if (!pending_start_update_callback_.is_null())
452 DoPendingStartUpdate(); 453 DoPendingStartUpdate();
453 else if (!pending_swap_cache_callback_.is_null()) 454 else if (!pending_swap_cache_callback_.is_null())
454 DoPendingSwapCache(); 455 DoPendingSwapCache();
455 456
456 FOR_EACH_OBSERVER(Observer, observers_, OnCacheSelectionComplete(this)); 457 for (auto& observer : observers_)
458 observer.OnCacheSelectionComplete(this);
457 } 459 }
458 460
459 void AppCacheHost::OnServiceReinitialized( 461 void AppCacheHost::OnServiceReinitialized(
460 AppCacheStorageReference* old_storage_ref) { 462 AppCacheStorageReference* old_storage_ref) {
461 // We continue to use the disabled instance, but arrange for its 463 // We continue to use the disabled instance, but arrange for its
462 // deletion when its no longer needed. 464 // deletion when its no longer needed.
463 if (old_storage_ref->storage() == storage()) 465 if (old_storage_ref->storage() == storage())
464 disabled_storage_reference_ = old_storage_ref; 466 disabled_storage_reference_ = old_storage_ref;
465 } 467 }
466 468
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 associated_cache_info_pending_ = cache && !cache->is_complete(); 569 associated_cache_info_pending_ = cache && !cache->is_complete();
568 AppCacheInfo info; 570 AppCacheInfo info;
569 if (cache) 571 if (cache)
570 cache->AssociateHost(this); 572 cache->AssociateHost(this);
571 573
572 FillCacheInfo(cache, manifest_url, GetStatus(), &info); 574 FillCacheInfo(cache, manifest_url, GetStatus(), &info);
573 frontend_->OnCacheSelected(host_id_, info); 575 frontend_->OnCacheSelected(host_id_, info);
574 } 576 }
575 577
576 } // namespace content 578 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_group.cc ('k') | content/browser/appcache/appcache_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698