summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.h
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-11-29 18:12:05 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-09 22:49:08 +0100
commit0806bc2d1b518b53681b3d8023def95ba8122630 (patch)
tree988c0b5574dfbae892d1764432399ea16a98297a /src/corelib/tools/qarraydata.h
parent4714f86c54eb358ec431fb94d6b135b4cad2a7c7 (diff)
Allocate/free support in QArrayData
Centralizing QArrayData memory management decisions in one place will allow us to be smarter in how we allocate header and data. At the moment, these are allocated as a single block. In the future we may decide to allocate them separately for "large" data or specific alignment requirements. For users of QArrayData this remains transparent and not part of the ABI. The offset field in QArrayDataHeader enables this. This also hard-wires allocation of empty arrays to return shared_empty. Allocating detached headers (e.g., to support fromRawData) will thus require explicit support. Change-Id: Icac5a1f51ee7e468c76b4493d29debc18780e5dc Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r--src/corelib/tools/qarraydata.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 0b6949fe48..684f00870d 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -73,6 +73,11 @@ struct Q_CORE_EXPORT QArrayData
return reinterpret_cast<const char *>(this) + offset;
}
+ static QArrayData *allocate(size_t objectSize, size_t alignment,
+ size_t capacity, bool reserve) Q_REQUIRED_RESULT;
+ static void deallocate(QArrayData *data, size_t objectSize,
+ size_t alignment);
+
static const QArrayData shared_null;
static const QArrayData shared_empty;
};