| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (size < 0) | 165 if (size < 0) |
| 166 CRASH(); | 166 CRASH(); |
| 167 | 167 |
| 168 append(data, size); | 168 append(data, size); |
| 169 | 169 |
| 170 #ifdef SHARED_BUFFER_STATS | 170 #ifdef SHARED_BUFFER_STATS |
| 171 didCreateSharedBuffer(this); | 171 didCreateSharedBuffer(this); |
| 172 #endif | 172 #endif |
| 173 } | 173 } |
| 174 | 174 |
| 175 SharedBuffer::SharedBuffer(const char* data, int size, PurgeableVector::Purgeabl
eOption purgeable) | 175 SharedBuffer::SharedBuffer(const char* data, unsigned size, PurgeableVector::Pur
geableOption purgeable) |
| 176 : m_size(0) | 176 : m_size(0) |
| 177 , m_buffer(purgeable) | 177 , m_buffer(purgeable) |
| 178 { | 178 { |
| 179 // FIXME: Use unsigned consistently, and check for invalid casts when callin
g into SharedBuffer from other code. | |
| 180 if (size < 0) | |
| 181 CRASH(); | |
| 182 | |
| 183 append(data, size); | 179 append(data, size); |
| 184 | 180 |
| 185 #ifdef SHARED_BUFFER_STATS | 181 #ifdef SHARED_BUFFER_STATS |
| 186 didCreateSharedBuffer(this); | 182 didCreateSharedBuffer(this); |
| 187 #endif | 183 #endif |
| 188 } | 184 } |
| 189 | 185 |
| 190 SharedBuffer::SharedBuffer(const unsigned char* data, int size) | 186 SharedBuffer::SharedBuffer(const unsigned char* data, int size) |
| 191 : m_size(0) | 187 : m_size(0) |
| 192 , m_buffer(PurgeableVector::NotPurgeable) | 188 , m_buffer(PurgeableVector::NotPurgeable) |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 mergeSegmentsIntoBuffer(); | 409 mergeSegmentsIntoBuffer(); |
| 414 m_buffer.unlock(); | 410 m_buffer.unlock(); |
| 415 } | 411 } |
| 416 | 412 |
| 417 bool SharedBuffer::isLocked() const | 413 bool SharedBuffer::isLocked() const |
| 418 { | 414 { |
| 419 return m_buffer.isLocked(); | 415 return m_buffer.isLocked(); |
| 420 } | 416 } |
| 421 | 417 |
| 422 } // namespace blink | 418 } // namespace blink |
| OLD | NEW |