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

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

Issue 16988003: Revert "Extract ContextLifecycleNotifier from ScriptExecutionContext." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« 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 14 matching lines...) Expand all
25 25
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/dom/DocumentLifecycleObserver.h" 28 #include "core/dom/DocumentLifecycleObserver.h"
29 29
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 DocumentLifecycleObserver::DocumentLifecycleObserver(Document* document) 34 DocumentLifecycleObserver::DocumentLifecycleObserver(Document* document)
35 : ContextDestructionObserver(document, DocumentLifecycleObserverType) 35 : ContextDestructionObserver(document)
36 { 36 {
37 document->addLifecycleObserver(this);
37 } 38 }
38 39
39 DocumentLifecycleObserver::~DocumentLifecycleObserver() 40 PassOwnPtr<DocumentLifecycleNotifier> DocumentLifecycleNotifier::create()
40 { 41 {
41 observeContext(0, DocumentLifecycleObserverType); 42 return adoptPtr(new DocumentLifecycleNotifier());
42 } 43 }
43 44
44 DocumentLifecycleNotifier::DocumentLifecycleNotifier(ScriptExecutionContext* con text) 45 void DocumentLifecycleNotifier::addObserver(DocumentLifecycleObserver* observer)
45 : ContextLifecycleNotifier(context)
46 { 46 {
47 } 47 ASSERT(!m_iterating);
48 48 ASSERT(!m_observers.contains(observer));
49 void DocumentLifecycleNotifier::addObserver(ContextDestructionObserver* observer , ContextDestructionObserver::Type as) 49 m_observers.append(observer);
50 {
51 RELEASE_ASSERT(!m_iterating);
52 if (as == ContextDestructionObserver::DocumentLifecycleObserverType)
53 m_documentObservers.add(static_cast<DocumentLifecycleObserver*>(observer ));
54 ContextLifecycleNotifier::addObserver(observer, as);
55 }
56
57 void DocumentLifecycleNotifier::removeObserver(ContextDestructionObserver* obser ver, ContextDestructionObserver::Type as)
58 {
59 RELEASE_ASSERT(!m_iterating);
60 if (as == ContextDestructionObserver::DocumentLifecycleObserverType)
61 m_documentObservers.remove(static_cast<DocumentLifecycleObserver*>(obser ver));
62 ContextLifecycleNotifier::removeObserver(observer, as);
63 } 50 }
64 51
65 } // namespace WebCore 52 } // 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