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

Side by Side Diff: third_party/WebKit/Source/platform/LifecycleContextTest.cpp

Issue 2629593004: Disambiguate LifecycleObserver::contextDestroyed (Closed)
Patch Set: temp Created 3 years, 11 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
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 class TestingObserver final 49 class TestingObserver final
50 : public GarbageCollected<TestingObserver>, 50 : public GarbageCollected<TestingObserver>,
51 public LifecycleObserver<DummyContext, TestingObserver> { 51 public LifecycleObserver<DummyContext, TestingObserver> {
52 USING_GARBAGE_COLLECTED_MIXIN(TestingObserver); 52 USING_GARBAGE_COLLECTED_MIXIN(TestingObserver);
53 53
54 public: 54 public:
55 static TestingObserver* create(DummyContext* context) { 55 static TestingObserver* create(DummyContext* context) {
56 return new TestingObserver(context); 56 return new TestingObserver(context);
57 } 57 }
58 58
59 void contextDestroyed() override { 59 void contextDestroyed(DummyContext* destroyedContext) override {
60 LifecycleObserver::contextDestroyed();
61 if (m_observerToRemoveOnDestruct) { 60 if (m_observerToRemoveOnDestruct) {
62 lifecycleContext()->removeObserver(m_observerToRemoveOnDestruct); 61 destroyedContext->removeObserver(m_observerToRemoveOnDestruct);
63 m_observerToRemoveOnDestruct.clear(); 62 m_observerToRemoveOnDestruct.clear();
64 } 63 }
65 m_contextDestroyedCalled = true; 64 m_contextDestroyedCalled = true;
66 } 65 }
67 66
68 DEFINE_INLINE_TRACE() { 67 DEFINE_INLINE_TRACE() {
69 visitor->trace(m_observerToRemoveOnDestruct); 68 visitor->trace(m_observerToRemoveOnDestruct);
70 LifecycleObserver::trace(visitor); 69 LifecycleObserver::trace(visitor);
71 } 70 }
72 71
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 129
131 context->notifyContextDestroyed(); 130 context->notifyContextDestroyed();
132 EXPECT_EQ(observer->innerObserver(), nullptr); 131 EXPECT_EQ(observer->innerObserver(), nullptr);
133 context = nullptr; 132 context = nullptr;
134 ThreadState::current()->collectAllGarbage(); 133 ThreadState::current()->collectAllGarbage();
135 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); 134 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0));
136 EXPECT_TRUE(observer->contextDestroyedCalled()); 135 EXPECT_TRUE(observer->contextDestroyedCalled());
137 } 136 }
138 137
139 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USBDevice.cpp ('k') | third_party/WebKit/Source/platform/LifecycleNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698