track total size of static array and Unit/Class/Func
[hiphop-php.git] / hphp / runtime / base / apc-collection.h
blob26249c92a093f149c9bbfa3a38d0f391feb7085b
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_APC_COLLECTION_H_
17 #define incl_HPHP_APC_COLLECTION_H_
19 #include "hphp/runtime/base/apc-handle.h"
21 namespace HPHP {
23 struct ObjectData;
24 struct Object;
26 //////////////////////////////////////////////////////////////////////
28 struct APCCollection {
29 static APCHandle::Pair Make(const ObjectData*,
30 APCHandleLevel level,
31 bool unserializeObj);
32 static void Delete(APCHandle*);
34 static const APCCollection* fromHandle(const APCHandle* handle) {
35 assertx(handle->checkInvariants());
36 assertx(handle->kind() == APCKind::SharedCollection);
37 static_assert(offsetof(APCCollection, m_handle) == 0, "");
38 return reinterpret_cast<const APCCollection*>(handle);
41 Object createObject() const;
43 private:
44 APCCollection();
45 ~APCCollection();
46 static APCHandle::Pair WrapArray(APCHandle::Pair, CollectionType);
48 private:
49 APCHandle m_handle;
50 APCHandle* m_arrayHandle;
51 CollectionType m_colType;
54 //////////////////////////////////////////////////////////////////////
58 #endif