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

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

Issue 2634713002: Remove PageVisibilityObserver contextDestroyed() notifications. (Closed)
Patch Set: prefer type aliases 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(DummyContext* destroyedContext) override { 59 void contextDestroyed(DummyContext* destroyedContext) {
60 if (m_observerToRemoveOnDestruct) { 60 if (m_observerToRemoveOnDestruct) {
61 destroyedContext->removeObserver(m_observerToRemoveOnDestruct); 61 destroyedContext->removeObserver(m_observerToRemoveOnDestruct);
62 m_observerToRemoveOnDestruct.clear(); 62 m_observerToRemoveOnDestruct.clear();
63 } 63 }
64 m_contextDestroyedCalled = true; 64 m_contextDestroyedCalled = true;
65 } 65 }
66 66
67 DEFINE_INLINE_TRACE() { 67 DEFINE_INLINE_TRACE() {
68 visitor->trace(m_observerToRemoveOnDestruct); 68 visitor->trace(m_observerToRemoveOnDestruct);
69 LifecycleObserver::trace(visitor); 69 LifecycleObserver::trace(visitor);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 context->notifyContextDestroyed(); 130 context->notifyContextDestroyed();
131 EXPECT_EQ(observer->innerObserver(), nullptr); 131 EXPECT_EQ(observer->innerObserver(), nullptr);
132 context = nullptr; 132 context = nullptr;
133 ThreadState::current()->collectAllGarbage(); 133 ThreadState::current()->collectAllGarbage();
134 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); 134 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0));
135 EXPECT_TRUE(observer->contextDestroyedCalled()); 135 EXPECT_TRUE(observer->contextDestroyedCalled());
136 } 136 }
137 137
138 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp ('k') | third_party/WebKit/Source/platform/LifecycleNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698