| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 size_t SharedBuffer::getSomeDataInternal(const char*& someData, | 175 size_t SharedBuffer::getSomeDataInternal(const char*& someData, |
| 176 size_t position) const { | 176 size_t position) const { |
| 177 size_t totalSize = size(); | 177 size_t totalSize = size(); |
| 178 if (position >= totalSize) { | 178 if (position >= totalSize) { |
| 179 someData = 0; | 179 someData = 0; |
| 180 return 0; | 180 return 0; |
| 181 } | 181 } |
| 182 | 182 |
| 183 ASSERT_WITH_SECURITY_IMPLICATION(position < m_size); | 183 SECURITY_DCHECK(position < m_size); |
| 184 size_t consecutiveSize = m_buffer.size(); | 184 size_t consecutiveSize = m_buffer.size(); |
| 185 if (position < consecutiveSize) { | 185 if (position < consecutiveSize) { |
| 186 someData = m_buffer.data() + position; | 186 someData = m_buffer.data() + position; |
| 187 return consecutiveSize - position; | 187 return consecutiveSize - position; |
| 188 } | 188 } |
| 189 | 189 |
| 190 position -= consecutiveSize; | 190 position -= consecutiveSize; |
| 191 size_t segments = m_segments.size(); | 191 size_t segments = m_segments.size(); |
| 192 size_t maxSegmentedSize = segments * kSegmentSize; | 192 size_t maxSegmentedSize = segments * kSegmentSize; |
| 193 size_t segment = segmentIndex(position); | 193 size_t segment = segmentIndex(position); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // using fastMalloc. | 260 // using fastMalloc. |
| 261 const String dataDumpName = dumpPrefix + "/segments"; | 261 const String dataDumpName = dumpPrefix + "/segments"; |
| 262 auto dump = memoryDump->createMemoryAllocatorDump(dataDumpName); | 262 auto dump = memoryDump->createMemoryAllocatorDump(dataDumpName); |
| 263 dump->addScalar("size", "bytes", m_size); | 263 dump->addScalar("size", "bytes", m_size); |
| 264 memoryDump->addSuballocation( | 264 memoryDump->addSuballocation( |
| 265 dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); | 265 dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace blink | 269 } // namespace blink |
| OLD | NEW |