IDBGetAllResult.cpp [plain text]
#include "config.h"
#include "IDBGetAllResult.h"
#if ENABLE(INDEXED_DATABASE)
#include <wtf/CrossThreadCopier.h>
#include <wtf/HashSet.h>
namespace WebCore {
IDBGetAllResult::IDBGetAllResult(const IDBGetAllResult& that, IsolatedCopyTag)
{
isolatedCopy(that, *this);
}
IDBGetAllResult IDBGetAllResult::isolatedCopy() const
{
return { *this, IsolatedCopy };
}
void IDBGetAllResult::isolatedCopy(const IDBGetAllResult& source, IDBGetAllResult& destination)
{
destination.m_type = source.m_type;
destination.m_keys = crossThreadCopy(source.m_keys);
destination.m_values = crossThreadCopy(source.m_values);
destination.m_keyPath = WebCore::isolatedCopy(source.m_keyPath);
}
void IDBGetAllResult::addKey(IDBKeyData&& key)
{
m_keys.append(WTFMove(key));
}
void IDBGetAllResult::addValue(IDBValue&& value)
{
m_values.append(WTFMove(value));
}
const Vector<IDBKeyData>& IDBGetAllResult::keys() const
{
return m_keys;
}
const Vector<IDBValue>& IDBGetAllResult::values() const
{
return m_values;
}
Vector<String> IDBGetAllResult::allBlobFilePaths() const
{
ASSERT(m_type == IndexedDB::GetAllType::Values);
HashSet<String> pathSet;
for (auto& value : m_values) {
for (auto& path : value.blobFilePaths())
pathSet.add(path);
}
return copyToVector(pathSet);
}
}
#endif // ENABLE(INDEXED_DATABASE)