Removing old GetObject.
This commit is contained in:
parent
a2b66f9109
commit
814ec82ad4
|
@ -151,42 +151,6 @@ X_STATUS ObjectTable::RemoveHandle(X_HANDLE handle) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
X_STATUS ObjectTable::GetObject(X_HANDLE handle, XObject** out_object,
|
|
||||||
bool already_locked) {
|
|
||||||
handle = TranslateHandle(handle);
|
|
||||||
if (!handle) {
|
|
||||||
return X_STATUS_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
XObject* object = nullptr;
|
|
||||||
if (!already_locked) {
|
|
||||||
table_mutex_.lock();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lower 2 bits are ignored.
|
|
||||||
uint32_t slot = handle >> 2;
|
|
||||||
|
|
||||||
// Verify slot.
|
|
||||||
if (slot < table_capacity_) {
|
|
||||||
ObjectTableEntry& entry = table_[slot];
|
|
||||||
if (entry.object) {
|
|
||||||
object = entry.object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retain the object pointer.
|
|
||||||
if (object) {
|
|
||||||
object->Retain();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!already_locked) {
|
|
||||||
table_mutex_.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
*out_object = object;
|
|
||||||
return object ? X_STATUS_SUCCESS : X_STATUS_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
XObject* ObjectTable::LookupObject(X_HANDLE handle, bool already_locked) {
|
XObject* ObjectTable::LookupObject(X_HANDLE handle, bool already_locked) {
|
||||||
handle = TranslateHandle(handle);
|
handle = TranslateHandle(handle);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
|
|
|
@ -28,8 +28,6 @@ class ObjectTable {
|
||||||
|
|
||||||
X_STATUS AddHandle(XObject* object, X_HANDLE* out_handle);
|
X_STATUS AddHandle(XObject* object, X_HANDLE* out_handle);
|
||||||
X_STATUS RemoveHandle(X_HANDLE handle);
|
X_STATUS RemoveHandle(X_HANDLE handle);
|
||||||
X_STATUS GetObject(X_HANDLE handle, XObject** out_object,
|
|
||||||
bool already_locked = false);
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
object_ref<T> LookupObject(X_HANDLE handle) {
|
object_ref<T> LookupObject(X_HANDLE handle) {
|
||||||
auto object = LookupObject(handle, false);
|
auto object = LookupObject(handle, false);
|
||||||
|
|
Loading…
Reference in New Issue