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

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

Issue 2464273002: Fix ThreadHeap::isHeapObjectAlive(const T*& ptr) stack overflow. (Closed)
Patch Set: Fix test. Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 int m_traceCount; 736 int m_traceCount;
737 }; 737 };
738 738
739 class ClassWithMember : public GarbageCollected<ClassWithMember> { 739 class ClassWithMember : public GarbageCollected<ClassWithMember> {
740 public: 740 public:
741 static ClassWithMember* create() { return new ClassWithMember(); } 741 static ClassWithMember* create() { return new ClassWithMember(); }
742 742
743 DEFINE_INLINE_TRACE() { 743 DEFINE_INLINE_TRACE() {
744 EXPECT_TRUE(ThreadHeap::isHeapObjectAlive(this)); 744 EXPECT_TRUE(ThreadHeap::isHeapObjectAlive(this));
745
746 // Const pointer should also be alive. See http://crbug.com/661363.
747 const ClassWithMember* constPtr = static_cast<const ClassWithMember*>(this);
748 EXPECT_TRUE(ThreadHeap::isHeapObjectAlive(constPtr));
749
745 if (!traceCount()) 750 if (!traceCount())
746 EXPECT_FALSE(ThreadHeap::isHeapObjectAlive(m_traceCounter)); 751 EXPECT_FALSE(ThreadHeap::isHeapObjectAlive(m_traceCounter));
747 else 752 else
748 EXPECT_TRUE(ThreadHeap::isHeapObjectAlive(m_traceCounter)); 753 EXPECT_TRUE(ThreadHeap::isHeapObjectAlive(m_traceCounter));
749 754
750 visitor->trace(m_traceCounter); 755 visitor->trace(m_traceCounter);
751 } 756 }
752 757
753 int traceCount() { return m_traceCounter->traceCount(); } 758 int traceCount() { return m_traceCounter->traceCount(); }
754 759
(...skipping 6046 matching lines...) Expand 10 before | Expand all | Expand 10 after
6801 "HeapVector"); 6806 "HeapVector");
6802 static_assert( 6807 static_assert(
6803 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value, 6808 WTF::IsGarbageCollectedType<HeapDeque<Member<IntWrapper>>>::value,
6804 "HeapDeque"); 6809 "HeapDeque");
6805 static_assert(WTF::IsGarbageCollectedType< 6810 static_assert(WTF::IsGarbageCollectedType<
6806 HeapTerminatedArray<Member<IntWrapper>>>::value, 6811 HeapTerminatedArray<Member<IntWrapper>>>::value,
6807 "HeapTerminatedArray"); 6812 "HeapTerminatedArray");
6808 } 6813 }
6809 6814
6810 } // namespace blink 6815 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698