| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 { | 31 { |
| 32 if (executionContext) | 32 if (executionContext) |
| 33 executionContext->allowWindowFocus(); | 33 executionContext->allowWindowFocus(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void dispose() | 36 void dispose() |
| 37 { | 37 { |
| 38 if (executionContext()) | 38 if (executionContext()) |
| 39 executionContext()->consumeWindowFocus(); | 39 executionContext()->consumeWindowFocus(); |
| 40 } | 40 } |
| 41 |
| 42 void trace(Visitor*) { } |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 // In Oilpan, destructors are not allowed to touch other on-heap objects. | 45 // In Oilpan, destructors are not allowed to touch other on-heap objects. |
| 44 // The Observer indirection is needed to keep | 46 // The Observer indirection is needed to keep |
| 45 // ScopedWindowFocusAllowedIndicator off-heap and thus allows its destructor | 47 // ScopedWindowFocusAllowedIndicator off-heap and thus allows its destructor |
| 46 // to call executionContext()->consumeWindowFocus(). | 48 // to call executionContext()->consumeWindowFocus(). |
| 47 OwnPtrWillBePersistent<Observer> m_observer; | 49 OwnPtrWillBePersistent<Observer> m_observer; |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 } // namespace blink | 52 } // namespace blink |
| 51 | 53 |
| 52 #endif // ScopedWindowFocusAllowedIndicator_h | 54 #endif // ScopedWindowFocusAllowedIndicator_h |
| OLD | NEW |