| 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 29 matching lines...) Expand all Loading... |
| 40 { | 40 { |
| 41 return new DummyContext; | 41 return new DummyContext; |
| 42 } | 42 } |
| 43 | 43 |
| 44 DEFINE_INLINE_TRACE() | 44 DEFINE_INLINE_TRACE() |
| 45 { | 45 { |
| 46 LifecycleNotifier<DummyContext, TestingObserver>::trace(visitor); | 46 LifecycleNotifier<DummyContext, TestingObserver>::trace(visitor); |
| 47 } | 47 } |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class TestingObserver final : public GarbageCollectedFinalized<TestingObserver>,
public LifecycleObserver<DummyContext, TestingObserver, DummyContext> { | 50 class TestingObserver final : public GarbageCollected<TestingObserver>, public L
ifecycleObserver<DummyContext, TestingObserver, DummyContext> { |
| 51 USING_GARBAGE_COLLECTED_MIXIN(TestingObserver); | 51 USING_GARBAGE_COLLECTED_MIXIN(TestingObserver); |
| 52 public: | 52 public: |
| 53 static TestingObserver* create(DummyContext* context) | 53 static TestingObserver* create(DummyContext* context) |
| 54 { | 54 { |
| 55 return new TestingObserver(context); | 55 return new TestingObserver(context); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void contextDestroyed() override | 58 void contextDestroyed() override |
| 59 { | 59 { |
| 60 LifecycleObserver::contextDestroyed(); | 60 LifecycleObserver::contextDestroyed(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 context->notifyContextDestroyed(); | 136 context->notifyContextDestroyed(); |
| 137 EXPECT_EQ(observer->innerObserver(), nullptr); | 137 EXPECT_EQ(observer->innerObserver(), nullptr); |
| 138 context = nullptr; | 138 context = nullptr; |
| 139 ThreadHeap::collectAllGarbage(); | 139 ThreadHeap::collectAllGarbage(); |
| 140 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); | 140 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); |
| 141 EXPECT_TRUE(observer->contextDestroyedCalled()); | 141 EXPECT_TRUE(observer->contextDestroyedCalled()); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |