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

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

Issue 901663005: Revert r189385 "Remove LifecycleContext" and r189391, r189530, r189456 that block it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/ExecutionContext.cpp ('k') | Source/core/frame/DOMWindowLifecycleNotifier.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef ScopedWindowFocusAllowedIndicator_h 5 #ifndef ScopedWindowFocusAllowedIndicator_h
6 #define ScopedWindowFocusAllowedIndicator_h 6 #define ScopedWindowFocusAllowedIndicator_h
7 7
8 #include "core/dom/ContextLifecycleObserver.h" 8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "wtf/Noncopyable.h" 10 #include "wtf/Noncopyable.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 private: 26 private:
27 class Observer final : public NoBaseWillBeGarbageCollectedFinalized<Observer >, public ContextLifecycleObserver { 27 class Observer final : public NoBaseWillBeGarbageCollectedFinalized<Observer >, public ContextLifecycleObserver {
28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Observer); 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Observer);
29 public: 29 public:
30 explicit Observer(ExecutionContext* executionContext) 30 explicit Observer(ExecutionContext* executionContext)
31 : ContextLifecycleObserver(executionContext) 31 : ContextLifecycleObserver(executionContext)
32 { 32 {
33 if (executionContext) 33 if (executionContext)
34 executionContext->allowWindowInteraction(); 34 executionContext->allowWindowFocus();
35 } 35 }
36 36
37 void dispose() 37 void dispose()
38 { 38 {
39 if (executionContext()) 39 if (executionContext())
40 executionContext()->consumeWindowInteraction(); 40 executionContext()->consumeWindowFocus();
41 } 41 }
42 42
43 void trace(Visitor* visitor) 43 void trace(Visitor* visitor)
44 { 44 {
45 ContextLifecycleObserver::trace(visitor); 45 ContextLifecycleObserver::trace(visitor);
46 } 46 }
47 }; 47 };
48 48
49 // In Oilpan, destructors are not allowed to touch other on-heap objects. 49 // In Oilpan, destructors are not allowed to touch other on-heap objects.
50 // The Observer indirection is needed to keep 50 // The Observer indirection is needed to keep
51 // ScopedWindowFocusAllowedIndicator off-heap and thus allows its destructor 51 // ScopedWindowFocusAllowedIndicator off-heap and thus allows its destructor
52 // to call executionContext()->consumeWindowInteraction(). 52 // to call executionContext()->consumeWindowFocus().
53 OwnPtrWillBePersistent<Observer> m_observer; 53 OwnPtrWillBePersistent<Observer> m_observer;
54 }; 54 };
55 55
56 } // namespace blink 56 } // namespace blink
57 57
58 #endif // ScopedWindowFocusAllowedIndicator_h 58 #endif // ScopedWindowFocusAllowedIndicator_h
OLDNEW
« no previous file with comments | « Source/core/dom/ExecutionContext.cpp ('k') | Source/core/frame/DOMWindowLifecycleNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698