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

Side by Side Diff: Source/core/dom/DocumentLifecycleObserver.cpp

Issue 18777003: Extract simpler classes for observing context lifecycle and observe Page lifecycle inNavigatorVibra… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaselined~ Created 7 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
« no previous file with comments | « Source/core/dom/DocumentLifecycleObserver.h ('k') | Source/core/dom/ScriptExecutionContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All Rights Reserved. 2 * Copyright (C) 2013 Google Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 DocumentLifecycleObserver::~DocumentLifecycleObserver() 39 DocumentLifecycleObserver::~DocumentLifecycleObserver()
40 { 40 {
41 observeContext(0, DocumentLifecycleObserverType); 41 observeContext(0, DocumentLifecycleObserverType);
42 } 42 }
43 43
44 DocumentLifecycleNotifier::DocumentLifecycleNotifier(ScriptExecutionContext* con text) 44 DocumentLifecycleNotifier::DocumentLifecycleNotifier(ScriptExecutionContext* con text)
45 : ContextLifecycleNotifier(context) 45 : ContextLifecycleNotifier(context)
46 { 46 {
47 } 47 }
48 48
49 void DocumentLifecycleNotifier::addObserver(ContextLifecycleObserver* observer, ContextLifecycleObserver::Type as) 49 void DocumentLifecycleNotifier::addObserver(LifecycleObserver* observer, Lifecyc leObserver::Type type)
50 { 50 {
51 if (as == ContextLifecycleObserver::DocumentLifecycleObserverType) { 51 if (type == LifecycleObserver::DocumentLifecycleObserverType) {
52 RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers); 52 RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
53 m_documentObservers.add(static_cast<DocumentLifecycleObserver*>(observer )); 53 m_documentObservers.add(static_cast<DocumentLifecycleObserver*>(observer ));
54 } 54 }
55 55
56 ContextLifecycleNotifier::addObserver(observer, as); 56 ContextLifecycleNotifier::addObserver(observer, type);
57 } 57 }
58 58
59 void DocumentLifecycleNotifier::removeObserver(ContextLifecycleObserver* observe r, ContextLifecycleObserver::Type as) 59 void DocumentLifecycleNotifier::removeObserver(LifecycleObserver* observer, Life cycleObserver::Type type)
60 { 60 {
61 if (as == ContextLifecycleObserver::DocumentLifecycleObserverType) { 61 if (type == LifecycleObserver::DocumentLifecycleObserverType) {
62 RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers); 62 RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
63 m_documentObservers.remove(static_cast<DocumentLifecycleObserver*>(obser ver)); 63 m_documentObservers.remove(static_cast<DocumentLifecycleObserver*>(obser ver));
64 } 64 }
65 65
66 ContextLifecycleNotifier::removeObserver(observer, as); 66 ContextLifecycleNotifier::removeObserver(observer, type);
67 } 67 }
68 68
69 } // namespace WebCore 69 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentLifecycleObserver.h ('k') | Source/core/dom/ScriptExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698