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

Side by Side Diff: content/browser/dom_storage/dom_storage_context_impl.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) 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 "content/browser/dom_storage/dom_storage_context_impl.h" 5 #include "content/browser/dom_storage/dom_storage_context_impl.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 void DOMStorageContextImpl::RemoveEventObserver(EventObserver* observer) { 294 void DOMStorageContextImpl::RemoveEventObserver(EventObserver* observer) {
295 event_observers_.RemoveObserver(observer); 295 event_observers_.RemoveObserver(observer);
296 } 296 }
297 297
298 void DOMStorageContextImpl::NotifyItemSet( 298 void DOMStorageContextImpl::NotifyItemSet(
299 const DOMStorageArea* area, 299 const DOMStorageArea* area,
300 const base::string16& key, 300 const base::string16& key,
301 const base::string16& new_value, 301 const base::string16& new_value,
302 const base::NullableString16& old_value, 302 const base::NullableString16& old_value,
303 const GURL& page_url) { 303 const GURL& page_url) {
304 FOR_EACH_OBSERVER( 304 for (auto& observer : event_observers_)
305 EventObserver, event_observers_, 305 observer.OnDOMStorageItemSet(area, key, new_value, old_value, page_url);
306 OnDOMStorageItemSet(area, key, new_value, old_value, page_url));
307 } 306 }
308 307
309 void DOMStorageContextImpl::NotifyItemRemoved( 308 void DOMStorageContextImpl::NotifyItemRemoved(
310 const DOMStorageArea* area, 309 const DOMStorageArea* area,
311 const base::string16& key, 310 const base::string16& key,
312 const base::string16& old_value, 311 const base::string16& old_value,
313 const GURL& page_url) { 312 const GURL& page_url) {
314 FOR_EACH_OBSERVER( 313 for (auto& observer : event_observers_)
315 EventObserver, event_observers_, 314 observer.OnDOMStorageItemRemoved(area, key, old_value, page_url);
316 OnDOMStorageItemRemoved(area, key, old_value, page_url));
317 } 315 }
318 316
319 void DOMStorageContextImpl::NotifyAreaCleared( 317 void DOMStorageContextImpl::NotifyAreaCleared(
320 const DOMStorageArea* area, 318 const DOMStorageArea* area,
321 const GURL& page_url) { 319 const GURL& page_url) {
322 FOR_EACH_OBSERVER( 320 for (auto& observer : event_observers_)
323 EventObserver, event_observers_, 321 observer.OnDOMStorageAreaCleared(area, page_url);
324 OnDOMStorageAreaCleared(area, page_url));
325 } 322 }
326 323
327 int64_t DOMStorageContextImpl::AllocateSessionId() { 324 int64_t DOMStorageContextImpl::AllocateSessionId() {
328 return base::subtle::Barrier_AtomicIncrement(&session_id_sequence_, 1); 325 return base::subtle::Barrier_AtomicIncrement(&session_id_sequence_, 1);
329 } 326 }
330 327
331 std::string DOMStorageContextImpl::AllocatePersistentSessionId() { 328 std::string DOMStorageContextImpl::AllocatePersistentSessionId() {
332 std::string guid = base::GenerateGUID(); 329 std::string guid = base::GenerateGUID();
333 std::replace(guid.begin(), guid.end(), '-', '_'); 330 std::replace(guid.begin(), guid.end(), '-', '_');
334 return guid; 331 return guid;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 DOMStorageNamespace* local) { 625 DOMStorageNamespace* local) {
629 local->DeleteLocalStorageOrigin(origin); 626 local->DeleteLocalStorageOrigin(origin);
630 // Synthesize a 'cleared' event if the area is open so CachedAreas in 627 // Synthesize a 'cleared' event if the area is open so CachedAreas in
631 // renderers get emptied out too. 628 // renderers get emptied out too.
632 DOMStorageArea* area = local->GetOpenStorageArea(origin); 629 DOMStorageArea* area = local->GetOpenStorageArea(origin);
633 if (area) 630 if (area)
634 NotifyAreaCleared(area, origin); 631 NotifyAreaCleared(area, origin);
635 } 632 }
636 633
637 } // namespace content 634 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/service_worker_devtools_manager.cc ('k') | content/browser/download/download_item_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698