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 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 4957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4968 | 4968 |
4969 static volatile IntWrapper* s_workerObjectPointer; | 4969 static volatile IntWrapper* s_workerObjectPointer; |
4970 }; | 4970 }; |
4971 | 4971 |
4972 TEST(HeapTest, RecursiveMutex) | 4972 TEST(HeapTest, RecursiveMutex) |
4973 { | 4973 { |
4974 RecursiveLockingTester::test(); | 4974 RecursiveLockingTester::test(); |
4975 } | 4975 } |
4976 | 4976 |
4977 template<typename T> | 4977 template<typename T> |
4978 class TraceIfNeededTester : public GarbageCollected<TraceIfNeededTester<T> > { | 4978 class TraceIfNeededTester : public GarbageCollectedFinalized<TraceIfNeededTester <T> > { |
zerny-chromium
2014/08/11 08:23:59
Thanks! I indeed forgot the finalization requireme
| |
4979 public: | 4979 public: |
4980 static TraceIfNeededTester<T>* create() { return new TraceIfNeededTester<T>( ); } | 4980 static TraceIfNeededTester<T>* create() { return new TraceIfNeededTester<T>( ); } |
4981 static TraceIfNeededTester<T>* create(const T& obj) { return new TraceIfNeed edTester<T>(obj); } | 4981 static TraceIfNeededTester<T>* create(const T& obj) { return new TraceIfNeed edTester<T>(obj); } |
4982 void trace(Visitor* visitor) { TraceIfNeeded<T>::trace(visitor, &m_obj); } | 4982 void trace(Visitor* visitor) { TraceIfNeeded<T>::trace(visitor, &m_obj); } |
4983 T& obj() { return m_obj; } | 4983 T& obj() { return m_obj; } |
4984 ~TraceIfNeededTester() { } | |
4984 private: | 4985 private: |
4985 TraceIfNeededTester() { } | 4986 TraceIfNeededTester() { } |
4986 explicit TraceIfNeededTester(const T& obj) : m_obj(obj) { } | 4987 explicit TraceIfNeededTester(const T& obj) : m_obj(obj) { } |
4987 T m_obj; | 4988 T m_obj; |
4988 }; | 4989 }; |
4989 | 4990 |
4990 class PartObject { | 4991 class PartObject { |
4991 DISALLOW_ALLOCATION(); | 4992 DISALLOW_ALLOCATION(); |
4992 public: | 4993 public: |
4993 PartObject() : m_obj(SimpleObject::create()) { } | 4994 PartObject() : m_obj(SimpleObject::create()) { } |
(...skipping 30 matching lines...) Expand all Loading... | |
5024 { | 5025 { |
5025 TraceIfNeededTester<HeapVector<Member<SimpleObject> > >* m_vec = TraceIf NeededTester<HeapVector<Member<SimpleObject> > >::create(); | 5026 TraceIfNeededTester<HeapVector<Member<SimpleObject> > >* m_vec = TraceIf NeededTester<HeapVector<Member<SimpleObject> > >::create(); |
5026 m_vec->obj().append(SimpleObject::create()); | 5027 m_vec->obj().append(SimpleObject::create()); |
5027 visitor.reset(); | 5028 visitor.reset(); |
5028 m_vec->trace(&visitor); | 5029 m_vec->trace(&visitor); |
5029 EXPECT_EQ(2u, visitor.count()); | 5030 EXPECT_EQ(2u, visitor.count()); |
5030 } | 5031 } |
5031 } | 5032 } |
5032 | 5033 |
5033 } // namespace blink | 5034 } // namespace blink |
OLD | NEW |