XObject no kernel state constructor

This commit is contained in:
Dr. Chat 2015-12-06 15:34:10 -06:00 committed by Ben Vanik
parent b3ed0fa445
commit 87931369e4
2 changed files with 11 additions and 4 deletions

View File

@ -27,13 +27,19 @@
namespace xe { namespace xe {
namespace kernel { namespace kernel {
XObject::XObject(Type type)
: kernel_state_(nullptr), pointer_ref_count_(1), type_(type) {
handles_.reserve(10);
}
XObject::XObject(KernelState* kernel_state, Type type) XObject::XObject(KernelState* kernel_state, Type type)
: kernel_state_(kernel_state), : kernel_state_(kernel_state),
pointer_ref_count_(1), pointer_ref_count_(1),
type_(type),
guest_object_ptr_(0), guest_object_ptr_(0),
allocated_guest_object_(false) { allocated_guest_object_(false) {
handles_.reserve(10); XObject::XObject(type);
// TODO: Assert kernel_state != nullptr in this constructor.
if (kernel_state) { if (kernel_state) {
X_HANDLE handle; X_HANDLE handle;
kernel_state->object_table()->AddHandle(this, &handle); kernel_state->object_table()->AddHandle(this, &handle);

View File

@ -125,6 +125,7 @@ class XObject {
kTypeTimer, kTypeTimer,
}; };
XObject(Type type);
XObject(KernelState* kernel_state, Type type); XObject(KernelState* kernel_state, Type type);
virtual ~XObject(); virtual ~XObject();
@ -223,8 +224,8 @@ class XObject {
// Guest pointer for kernel object. Remember: X_OBJECT_HEADER precedes this // Guest pointer for kernel object. Remember: X_OBJECT_HEADER precedes this
// if we allocated it! // if we allocated it!
uint32_t guest_object_ptr_; uint32_t guest_object_ptr_ = 0;
bool allocated_guest_object_; bool allocated_guest_object_ = false;
}; };
template <typename T> template <typename T>