OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 public: | 56 public: |
57 static PassOwnPtrWillBeRawPtr<TestingObserver> create(DummyContext* context) | 57 static PassOwnPtrWillBeRawPtr<TestingObserver> create(DummyContext* context) |
58 { | 58 { |
59 return adoptPtrWillBeNoop(new TestingObserver(context)); | 59 return adoptPtrWillBeNoop(new TestingObserver(context)); |
60 } | 60 } |
61 | 61 |
62 virtual void contextDestroyed() override | 62 virtual void contextDestroyed() override |
63 { | 63 { |
64 LifecycleObserver::contextDestroyed(); | 64 LifecycleObserver::contextDestroyed(); |
65 if (m_observerToRemoveOnDestruct) { | 65 if (m_observerToRemoveOnDestruct) { |
66 lifecycleContext()->removeObserver(m_observerToRemoveOnDestruct.get(
)); | 66 lifecycleContext()->removeObserver(m_observerToRemoveOnDestruct.get(
), false); |
67 m_observerToRemoveOnDestruct.clear(); | 67 m_observerToRemoveOnDestruct.clear(); |
68 } | 68 } |
69 m_contextDestroyedCalled = true; | 69 m_contextDestroyedCalled = true; |
70 } | 70 } |
71 | 71 |
72 DEFINE_INLINE_TRACE() | 72 DEFINE_INLINE_TRACE() |
73 { | 73 { |
74 visitor->trace(m_observerToRemoveOnDestruct); | 74 visitor->trace(m_observerToRemoveOnDestruct); |
75 LifecycleObserver::trace(visitor); | 75 LifecycleObserver::trace(visitor); |
76 } | 76 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 context->notifyContextDestroyed(); | 142 context->notifyContextDestroyed(); |
143 EXPECT_EQ(observer->innerObserver(), nullptr); | 143 EXPECT_EQ(observer->innerObserver(), nullptr); |
144 context = nullptr; | 144 context = nullptr; |
145 Heap::collectAllGarbage(); | 145 Heap::collectAllGarbage(); |
146 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); | 146 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); |
147 EXPECT_TRUE(observer->contextDestroyedCalled()); | 147 EXPECT_TRUE(observer->contextDestroyedCalled()); |
148 } | 148 } |
149 | 149 |
150 } // namespace blink | 150 } // namespace blink |
OLD | NEW |