| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "platform/LifecycleNotifier.h" | 29 #include "platform/LifecycleNotifier.h" |
| 30 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
| 31 #include <gtest/gtest.h> | 31 #include <gtest/gtest.h> |
| 32 | 32 |
| 33 using namespace blink; | 33 using namespace blink; |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class DummyContext final : public NoBaseWillBeGarbageCollectedFinalized<DummyCon
text>, public LifecycleNotifier<DummyContext> { | 37 class DummyContext final : public NoBaseWillBeGarbageCollectedFinalized<DummyCon
text>, public LifecycleNotifier<DummyContext> { |
| 38 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DummyContext); |
| 38 public: | 39 public: |
| 39 DummyContext() | 40 DummyContext() |
| 40 : LifecycleNotifier<DummyContext>(this) | 41 : LifecycleNotifier<DummyContext>(this) |
| 41 { | 42 { |
| 42 } | 43 } |
| 43 | 44 |
| 44 void trace(Visitor* visitor) | 45 void trace(Visitor* visitor) |
| 45 { | 46 { |
| 46 LifecycleNotifier<DummyContext>::trace(visitor); | 47 LifecycleNotifier<DummyContext>::trace(visitor); |
| 47 } | 48 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 Persistent<TestingObserver> observer = new TestingObserver(context.get()); | 102 Persistent<TestingObserver> observer = new TestingObserver(context.get()); |
| 102 observer->unobserve(); | 103 observer->unobserve(); |
| 103 context->notifyContextDestroyed(); | 104 context->notifyContextDestroyed(); |
| 104 context = nullptr; | 105 context = nullptr; |
| 105 Heap::collectAllGarbage(); | 106 Heap::collectAllGarbage(); |
| 106 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); | 107 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); |
| 107 EXPECT_FALSE(observer->m_contextDestroyedCalled); | 108 EXPECT_FALSE(observer->m_contextDestroyedCalled); |
| 108 } | 109 } |
| 109 | 110 |
| 110 } | 111 } |
| OLD | NEW |