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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapTest.cpp

Issue 2394683005: Remove ASSERT_UNUSED (Closed)
Patch Set: Created 4 years, 2 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 5481 matching lines...) Expand 10 before | Expand all | Expand 10 after
5492 // Since the worker thread is not sweeping the worker object should 5492 // Since the worker thread is not sweeping the worker object should
5493 // not have been finalized. 5493 // not have been finalized.
5494 EXPECT_EQ(0, IntWrapper::s_destructorCalls); 5494 EXPECT_EQ(0, IntWrapper::s_destructorCalls);
5495 5495
5496 // Put the worker thread's object address on the stack and do a 5496 // Put the worker thread's object address on the stack and do a
5497 // conservative GC. This should find the worker object, but since 5497 // conservative GC. This should find the worker object, but since
5498 // it was dead in the previous GC it should not be traced in this 5498 // it was dead in the previous GC it should not be traced in this
5499 // GC. 5499 // GC.
5500 uintptr_t stackPtrValue = s_workerObjectPointer; 5500 uintptr_t stackPtrValue = s_workerObjectPointer;
5501 s_workerObjectPointer = 0; 5501 s_workerObjectPointer = 0;
5502 ASSERT_UNUSED(stackPtrValue, stackPtrValue); 5502 DCHECK(stackPtrValue);
5503 conservativelyCollectGarbage(); 5503 conservativelyCollectGarbage();
5504 5504
5505 // Since the worker thread is not sweeping the worker object should 5505 // Since the worker thread is not sweeping the worker object should
5506 // not have been finalized. 5506 // not have been finalized.
5507 EXPECT_EQ(0, IntWrapper::s_destructorCalls); 5507 EXPECT_EQ(0, IntWrapper::s_destructorCalls);
5508 5508
5509 // Wake up the worker thread so it can continue with its sweeping. 5509 // Wake up the worker thread so it can continue with its sweeping.
5510 // This should finalized the worker object which we test below. 5510 // This should finalized the worker object which we test below.
5511 // The worker thread will go back to sleep once sweeping to ensure 5511 // The worker thread will go back to sleep once sweeping to ensure
5512 // we don't have thread local GCs until after validating the destructor 5512 // we don't have thread local GCs until after validating the destructor
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
5793 parkMainThread(); 5793 parkMainThread();
5794 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); 5794 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls);
5795 } 5795 }
5796 5796
5797 private: 5797 private:
5798 static void workerThreadMain() { 5798 static void workerThreadMain() {
5799 MutexLocker locker(workerThreadMutex()); 5799 MutexLocker locker(workerThreadMutex());
5800 ThreadState::attachCurrentThread(BlinkGC::MainThreadHeapMode); 5800 ThreadState::attachCurrentThread(BlinkGC::MainThreadHeapMode);
5801 5801
5802 DestructorLockingObject* dlo = DestructorLockingObject::create(); 5802 DestructorLockingObject* dlo = DestructorLockingObject::create();
5803 ASSERT_UNUSED(dlo, dlo); 5803 DCHECK(dlo);
5804 5804
5805 // Wake up the main thread which is waiting for the worker to do its 5805 // Wake up the main thread which is waiting for the worker to do its
5806 // allocation. 5806 // allocation.
5807 wakeMainThread(); 5807 wakeMainThread();
5808 5808
5809 // Wait for the main thread to get the global lock to ensure it has 5809 // Wait for the main thread to get the global lock to ensure it has
5810 // it before the worker tries to acquire it. We want the worker to 5810 // it before the worker tries to acquire it. We want the worker to
5811 // block in the SafePointAwareMutexLocker until the main thread 5811 // block in the SafePointAwareMutexLocker until the main thread
5812 // has done a GC. The GC will not mark the "dlo" object since the worker 5812 // has done a GC. The GC will not mark the "dlo" object since the worker
5813 // is entering the safepoint with NoHeapPointersOnStack. When the worker 5813 // is entering the safepoint with NoHeapPointersOnStack. When the worker
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
6801 "HeapVector"); 6801 "HeapVector");
6802 static_assert( 6802 static_assert(
6803 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value, 6803 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value,
6804 "HeapDeque"); 6804 "HeapDeque");
6805 static_assert(WTF::IsGarbageCollectedType< 6805 static_assert(WTF::IsGarbageCollectedType<
6806 HeapTerminatedArray<Member<IntWrapper>>>::value, 6806 HeapTerminatedArray<Member<IntWrapper>>>::value,
6807 "HeapTerminatedArray"); 6807 "HeapTerminatedArray");
6808 } 6808 }
6809 6809
6810 } // namespace blink 6810 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698