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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); | 1865 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); |
1866 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); | 1866 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); |
1867 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 1867 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
1868 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls); | 1868 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls); |
1869 } | 1869 } |
1870 | 1870 |
1871 class SimpleFinalizedEagerObjectBase : public GarbageCollectedFinalized<SimpleFi
nalizedEagerObjectBase> { | 1871 class SimpleFinalizedEagerObjectBase : public GarbageCollectedFinalized<SimpleFi
nalizedEagerObjectBase> { |
1872 public: | 1872 public: |
1873 virtual ~SimpleFinalizedEagerObjectBase() { } | 1873 virtual ~SimpleFinalizedEagerObjectBase() { } |
1874 DEFINE_INLINE_TRACE() { } | 1874 DEFINE_INLINE_TRACE() { } |
1875 | 1875 EAGERLY_FINALIZE(); |
1876 EAGERLY_SWEEP(); | |
1877 protected: | 1876 protected: |
1878 SimpleFinalizedEagerObjectBase() { } | 1877 SimpleFinalizedEagerObjectBase() { } |
1879 }; | 1878 }; |
1880 | 1879 |
1881 class SimpleFinalizedEagerObject : public SimpleFinalizedEagerObjectBase { | 1880 class SimpleFinalizedEagerObject : public SimpleFinalizedEagerObjectBase { |
1882 public: | 1881 public: |
1883 static SimpleFinalizedEagerObject* create() | 1882 static SimpleFinalizedEagerObject* create() |
1884 { | 1883 { |
1885 return new SimpleFinalizedEagerObject(); | 1884 return new SimpleFinalizedEagerObject(); |
1886 } | 1885 } |
1887 | 1886 |
1888 virtual ~SimpleFinalizedEagerObject() | 1887 virtual ~SimpleFinalizedEagerObject() |
1889 { | 1888 { |
1890 ++s_destructorCalls; | 1889 ++s_destructorCalls; |
1891 } | 1890 } |
1892 | 1891 |
1893 static int s_destructorCalls; | 1892 static int s_destructorCalls; |
1894 private: | 1893 private: |
1895 SimpleFinalizedEagerObject() { } | 1894 SimpleFinalizedEagerObject() { } |
1896 }; | 1895 }; |
1897 | 1896 |
1898 template<typename T> | 1897 template<typename T> |
1899 class ParameterizedButEmpty { | 1898 class ParameterizedButEmpty { |
1900 public: | 1899 public: |
1901 EAGERLY_SWEEP(); | 1900 EAGERLY_FINALIZE(); |
1902 }; | 1901 }; |
1903 | 1902 |
1904 class SimpleFinalizedObjectInstanceOfTemplate final : public GarbageCollectedFin
alized<SimpleFinalizedObjectInstanceOfTemplate>, public ParameterizedButEmpty<Si
mpleFinalizedObjectInstanceOfTemplate> { | 1903 class SimpleFinalizedObjectInstanceOfTemplate final : public GarbageCollectedFin
alized<SimpleFinalizedObjectInstanceOfTemplate>, public ParameterizedButEmpty<Si
mpleFinalizedObjectInstanceOfTemplate> { |
1905 public: | 1904 public: |
1906 static SimpleFinalizedObjectInstanceOfTemplate* create() | 1905 static SimpleFinalizedObjectInstanceOfTemplate* create() |
1907 { | 1906 { |
1908 return new SimpleFinalizedObjectInstanceOfTemplate(); | 1907 return new SimpleFinalizedObjectInstanceOfTemplate(); |
1909 } | 1908 } |
1910 ~SimpleFinalizedObjectInstanceOfTemplate() | 1909 ~SimpleFinalizedObjectInstanceOfTemplate() |
1911 { | 1910 { |
(...skipping 4199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6111 { | 6110 { |
6112 Persistent<ClassWithMember> object = ClassWithMember::create(); | 6111 Persistent<ClassWithMember> object = ClassWithMember::create(); |
6113 EXPECT_EQ(0, object->traceCount()); | 6112 EXPECT_EQ(0, object->traceCount()); |
6114 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); | 6113 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); |
6115 EXPECT_TRUE(mixin); | 6114 EXPECT_TRUE(mixin); |
6116 EXPECT_GT(object->traceCount(), 0); | 6115 EXPECT_GT(object->traceCount(), 0); |
6117 EXPECT_GT(mixin->traceCount(), 0); | 6116 EXPECT_GT(mixin->traceCount(), 0); |
6118 } | 6117 } |
6119 | 6118 |
6120 } // namespace blink | 6119 } // namespace blink |
OLD | NEW |