OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 22 matching lines...) Expand all Loading... |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 SharedBuffer::SharedBuffer(CFDataRef cfData) | 35 SharedBuffer::SharedBuffer(CFDataRef cfData) |
36 : m_size(0) | 36 : m_size(0) |
37 , m_cfData(cfData) | 37 , m_cfData(cfData) |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 // Mac is a CF platform but has an even more efficient version of this method, | 41 // Mac is a CF platform but has an even more efficient version of this method, |
42 // so only use this version for non-Mac | 42 // so only use this version for non-Mac |
43 #if !PLATFORM(MAC) && !(PLATFORM(QT) && USE(QTKIT)) | 43 #if !PLATFORM(MAC) |
44 CFDataRef SharedBuffer::createCFData() | 44 CFDataRef SharedBuffer::createCFData() |
45 { | 45 { |
46 if (m_cfData) { | 46 if (m_cfData) { |
47 CFRetain(m_cfData.get()); | 47 CFRetain(m_cfData.get()); |
48 return m_cfData.get(); | 48 return m_cfData.get(); |
49 } | 49 } |
50 | 50 |
51 // Internal data in SharedBuffer can be segmented. We need to get the contig
uous buffer. | 51 // Internal data in SharedBuffer can be segmented. We need to get the contig
uous buffer. |
52 const Vector<char>& contiguousBuffer = buffer(); | 52 const Vector<char>& contiguousBuffer = buffer(); |
53 return CFDataCreate(0, reinterpret_cast<const UInt8*>(contiguousBuffer.data(
)), contiguousBuffer.size()); | 53 return CFDataCreate(0, reinterpret_cast<const UInt8*>(contiguousBuffer.data(
)), contiguousBuffer.size()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return 0; | 152 return 0; |
153 | 153 |
154 if (m_dataArray.size() != 1) | 154 if (m_dataArray.size() != 1) |
155 return 0; | 155 return 0; |
156 | 156 |
157 return reinterpret_cast<const char*>(CFDataGetBytePtr(m_dataArray.at(0).get(
))); | 157 return reinterpret_cast<const char*>(CFDataGetBytePtr(m_dataArray.at(0).get(
))); |
158 } | 158 } |
159 #endif | 159 #endif |
160 | 160 |
161 } | 161 } |
OLD | NEW |