OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 void BlobData::appendBytes(const void* bytes, size_t length) | 115 void BlobData::appendBytes(const void* bytes, size_t length) |
116 { | 116 { |
117 RefPtr<RawData> data = RawData::create(); | 117 RefPtr<RawData> data = RawData::create(); |
118 Vector<char>* buffer = data->mutableData(); | 118 Vector<char>* buffer = data->mutableData(); |
119 buffer->append(static_cast<const char *>(bytes), length); | 119 buffer->append(static_cast<const char *>(bytes), length); |
120 m_items.append(BlobDataItem(data.release())); | 120 m_items.append(BlobDataItem(data.release())); |
121 } | 121 } |
122 | 122 |
123 void BlobData::swapItems(BlobDataItemList& items) | |
124 { | |
125 m_items.swap(items); | |
126 } | |
127 | 123 |
128 long long BlobData::length() const | 124 long long BlobData::length() const |
129 { | 125 { |
130 long long length = 0; | 126 long long length = 0; |
131 | 127 |
132 for (Vector<BlobDataItem>::const_iterator it = m_items.begin(); it != m_item
s.end(); ++it) { | 128 for (Vector<BlobDataItem>::const_iterator it = m_items.begin(); it != m_item
s.end(); ++it) { |
133 const BlobDataItem& item = *it; | 129 const BlobDataItem& item = *it; |
134 if (item.length != BlobDataItem::toEndOfFile) { | 130 if (item.length != BlobDataItem::toEndOfFile) { |
135 ASSERT(item.length >= 0); | 131 ASSERT(item.length >= 0); |
136 length += item.length; | 132 length += item.length; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 { | 168 { |
173 BlobRegistry::addBlobDataRef(m_uuid); | 169 BlobRegistry::addBlobDataRef(m_uuid); |
174 } | 170 } |
175 | 171 |
176 BlobDataHandle::~BlobDataHandle() | 172 BlobDataHandle::~BlobDataHandle() |
177 { | 173 { |
178 BlobRegistry::removeBlobDataRef(m_uuid); | 174 BlobRegistry::removeBlobDataRef(m_uuid); |
179 } | 175 } |
180 | 176 |
181 } // namespace blink | 177 } // namespace blink |
OLD | NEW |