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

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

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/Document.cpp ('k') | Source/core/dom/DocumentLifecycleObserver.cpp » ('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 26 matching lines...) Expand all
37 class Document; 37 class Document;
38 38
39 class DocumentLifecycleObserver : public ContextLifecycleObserver { 39 class DocumentLifecycleObserver : public ContextLifecycleObserver {
40 public: 40 public:
41 explicit DocumentLifecycleObserver(Document*); 41 explicit DocumentLifecycleObserver(Document*);
42 virtual ~DocumentLifecycleObserver(); 42 virtual ~DocumentLifecycleObserver();
43 virtual void documentWasDetached() { } 43 virtual void documentWasDetached() { }
44 virtual void documentWasDisposed() { } 44 virtual void documentWasDisposed() { }
45 }; 45 };
46 46
47 class DocumentLifecycleNotifier : public ContextLifecycleNotifier { 47 class DocumentLifecycleNotifier : public ContextLifecycleNotifier {
48 public: 48 public:
49 static PassOwnPtr<DocumentLifecycleNotifier> create(ScriptExecutionContext*) ; 49 static PassOwnPtr<DocumentLifecycleNotifier> create(ScriptExecutionContext*) ;
50 50
51 void notifyDocumentWasDetached(); 51 void notifyDocumentWasDetached();
52 void notifyDocumentWasDisposed(); 52 void notifyDocumentWasDisposed();
53 53
54 virtual void addObserver(ContextLifecycleObserver*, ContextLifecycleObserver ::Type as) OVERRIDE; 54 virtual void addObserver(LifecycleObserver*, LifecycleObserver::Type) OVERRI DE;
55 virtual void removeObserver(ContextLifecycleObserver*, ContextLifecycleObser ver::Type as) OVERRIDE; 55 virtual void removeObserver(LifecycleObserver*, LifecycleObserver::Type) OVE RRIDE;
56 56
57 private: 57 private:
58 explicit DocumentLifecycleNotifier(ScriptExecutionContext*); 58 explicit DocumentLifecycleNotifier(ScriptExecutionContext*);
59 59
60 typedef HashSet<DocumentLifecycleObserver*> DocumentObserverSet; 60 typedef HashSet<DocumentLifecycleObserver*> DocumentObserverSet;
61 DocumentObserverSet m_documentObservers; 61 DocumentObserverSet m_documentObservers;
62 }; 62 };
63 63
64 inline PassOwnPtr<DocumentLifecycleNotifier> DocumentLifecycleNotifier::create(S criptExecutionContext* context) 64 inline PassOwnPtr<DocumentLifecycleNotifier> DocumentLifecycleNotifier::create(S criptExecutionContext* context)
65 { 65 {
(...skipping 10 matching lines...) Expand all
76 inline void DocumentLifecycleNotifier::notifyDocumentWasDisposed() 76 inline void DocumentLifecycleNotifier::notifyDocumentWasDisposed()
77 { 77 {
78 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumen tObservers); 78 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumen tObservers);
79 for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_d ocumentObservers.end(); ++i) 79 for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_d ocumentObservers.end(); ++i)
80 (*i)->documentWasDisposed(); 80 (*i)->documentWasDisposed();
81 } 81 }
82 82
83 } // namespace WebCore 83 } // namespace WebCore
84 84
85 #endif // DocumentLifecycleObserver_h 85 #endif // DocumentLifecycleObserver_h
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/DocumentLifecycleObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698