Chromium Code Reviews| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 ++s_destructorCalls; | 334 ++s_destructorCalls; |
| 335 } | 335 } |
| 336 | 336 |
| 337 static int s_destructorCalls; | 337 static int s_destructorCalls; |
| 338 | 338 |
| 339 int value() const { return m_x; } | 339 int value() const { return m_x; } |
| 340 | 340 |
| 341 bool operator==(const OffHeapInt& other) const { return other.value() == val ue(); } | 341 bool operator==(const OffHeapInt& other) const { return other.value() == val ue(); } |
| 342 | 342 |
| 343 unsigned hash() { return IntHash<int>::hash(m_x); } | 343 unsigned hash() { return IntHash<int>::hash(m_x); } |
| 344 void voidFunction() { } | |
| 344 | 345 |
| 345 protected: | 346 protected: |
| 346 OffHeapInt(int x) : m_x(x) { } | 347 OffHeapInt(int x) : m_x(x) { } |
| 347 | 348 |
| 348 private: | 349 private: |
| 349 OffHeapInt(); | 350 OffHeapInt(); |
| 350 int m_x; | 351 int m_x; |
| 351 }; | 352 }; |
| 352 | 353 |
| 353 USED_FROM_MULTIPLE_THREADS(IntWrapper); | 354 USED_FROM_MULTIPLE_THREADS(IntWrapper); |
| (...skipping 3628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3982 { | 3983 { |
| 3983 Closure closure = bind(&Bar::trace, Bar::create(), static_cast<Visitor*>(0)) ; | 3984 Closure closure = bind(&Bar::trace, Bar::create(), static_cast<Visitor*>(0)) ; |
| 3984 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 3985 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 3985 // The closure should have a persistent handle to the Bar. | 3986 // The closure should have a persistent handle to the Bar. |
| 3986 EXPECT_EQ(1u, Bar::s_live); | 3987 EXPECT_EQ(1u, Bar::s_live); |
| 3987 | 3988 |
| 3988 Closure closure2 = bind(&Bar::trace, RawPtr<Bar>(Bar::create()), static_cast <Visitor*>(0)); | 3989 Closure closure2 = bind(&Bar::trace, RawPtr<Bar>(Bar::create()), static_cast <Visitor*>(0)); |
| 3989 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 3990 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 3990 // The closure should have a persistent handle to the Bar. | 3991 // The closure should have a persistent handle to the Bar. |
| 3991 EXPECT_EQ(2u, Bar::s_live); | 3992 EXPECT_EQ(2u, Bar::s_live); |
| 3993 // RawPtr<OffHeaInt> should not make Persistent. | |
|
Mads Ager (chromium)
2014/06/11 08:36:12
OffHeapInt
tkent
2014/06/11 08:39:47
Done.
| |
| 3994 Closure closure3 = bind(&OffHeapInt::voidFunction, RawPtr<OffHeapInt>(OffHea pInt::create(1).get())); | |
|
tkent
2014/06/11 08:12:17
This was not compilable without the Handle.h chang
| |
| 3992 | 3995 |
| 3993 UseMixin::s_traceCount = 0; | 3996 UseMixin::s_traceCount = 0; |
| 3994 Mixin* mixin = UseMixin::create(); | 3997 Mixin* mixin = UseMixin::create(); |
| 3995 Closure mixinClosure = bind(&Mixin::trace, mixin, static_cast<Visitor*>(0)); | 3998 Closure mixinClosure = bind(&Mixin::trace, mixin, static_cast<Visitor*>(0)); |
| 3996 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 3999 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 3997 // The closure should have a persistent handle to the mixin. | 4000 // The closure should have a persistent handle to the mixin. |
| 3998 EXPECT_EQ(1, UseMixin::s_traceCount); | 4001 EXPECT_EQ(1, UseMixin::s_traceCount); |
| 3999 } | 4002 } |
| 4000 | 4003 |
| 4001 } // WebCore namespace | 4004 } // WebCore namespace |
| OLD | NEW |