| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/heap/CallbackStack.h" | 5 #include "platform/heap/CallbackStack.h" |
| 6 #include "wtf/PageAllocator.h" | 6 #include "wtf/PageAllocator.h" |
| 7 | 7 |
| 8 namespace blink { | 8 namespace blink { |
| 9 | 9 |
| 10 size_t const CallbackStack::kMinimalBlockSize = WTF::kPageAllocationGranularity
/ sizeof(CallbackStack::Item); |
| 11 |
| 10 CallbackStack::Block::Block(Block* next, size_t blockSize) | 12 CallbackStack::Block::Block(Block* next, size_t blockSize) |
| 11 : m_blockSize(blockSize) | 13 : m_blockSize(blockSize) |
| 12 { | 14 { |
| 13 // Allocated block size must be a multiple of WTF::kPageAllocationGranularit
y. | 15 // Allocated block size must be a multiple of WTF::kPageAllocationGranularit
y. |
| 14 ASSERT((m_blockSize * sizeof(Item)) % WTF::kPageAllocationGranularity == 0); | 16 ASSERT((m_blockSize * sizeof(Item)) % WTF::kPageAllocationGranularity == 0); |
| 15 m_buffer = static_cast<Item*>(WTF::allocPages(nullptr, m_blockSize * sizeof(
Item), WTF::kPageAllocationGranularity, WTF::PageAccessible)); | 17 m_buffer = static_cast<Item*>(WTF::allocPages(nullptr, m_blockSize * sizeof(
Item), WTF::kPageAllocationGranularity, WTF::PageAccessible)); |
| 16 RELEASE_ASSERT(m_buffer); | 18 RELEASE_ASSERT(m_buffer); |
| 17 | 19 |
| 18 #if ENABLE(ASSERT) | 20 #if ENABLE(ASSERT) |
| 19 clear(); | 21 clear(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 { | 170 { |
| 169 for (Block* current = m_first; current; current = current->next()) { | 171 for (Block* current = m_first; current; current = current->next()) { |
| 170 if (current->hasCallbackForObject(object)) | 172 if (current->hasCallbackForObject(object)) |
| 171 return true; | 173 return true; |
| 172 } | 174 } |
| 173 return false; | 175 return false; |
| 174 } | 176 } |
| 175 #endif | 177 #endif |
| 176 | 178 |
| 177 } // namespace blink | 179 } // namespace blink |
| OLD | NEW |