mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
[Sysman] Replace normal pointers with smart pointers (4/n).
Replacing normal pointers by smart pointers in temperature module of L0 sysman. Related-To: LOCI-2810 Signed-off-by: Singh, Prasoon <prasoon.singh@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8119905325
commit
1a6f03c36e
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -12,18 +12,12 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
TemperatureHandleContext::~TemperatureHandleContext() {
|
||||
for (Temperature *pTemperature : handleList) {
|
||||
delete pTemperature;
|
||||
}
|
||||
}
|
||||
TemperatureHandleContext::~TemperatureHandleContext() {}
|
||||
|
||||
void TemperatureHandleContext::createHandle(const ze_device_handle_t &deviceHandle, zes_temp_sensors_t type) {
|
||||
Temperature *pTemperature = new TemperatureImp(deviceHandle, pOsSysman, type);
|
||||
std::unique_ptr<Temperature> pTemperature = std::make_unique<TemperatureImp>(deviceHandle, pOsSysman, type);
|
||||
if (pTemperature->initSuccess == true) {
|
||||
handleList.push_back(pTemperature);
|
||||
} else {
|
||||
delete pTemperature;
|
||||
handleList.push_back(std::move(pTemperature));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -42,7 +42,7 @@ struct TemperatureHandleContext {
|
||||
ze_result_t temperatureGet(uint32_t *pCount, zes_temp_handle_t *phTemperature);
|
||||
|
||||
OsSysman *pOsSysman = nullptr;
|
||||
std::vector<Temperature *> handleList = {};
|
||||
std::vector<std::unique_ptr<Temperature>> handleList = {};
|
||||
|
||||
private:
|
||||
void createHandle(const ze_device_handle_t &deviceHandle, zes_temp_sensors_t type);
|
||||
|
||||
@@ -34,10 +34,6 @@ class SysmanMultiDeviceTemperatureFixture : public SysmanMultiDeviceFixture {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
SysmanMultiDeviceFixture::SetUp();
|
||||
for (auto &handle : pSysmanDeviceImp->pTempHandleContext->handleList) {
|
||||
delete handle;
|
||||
handle = nullptr;
|
||||
}
|
||||
pSysmanDeviceImp->pTempHandleContext->handleList.clear();
|
||||
pFsAccess = std::make_unique<MockTemperatureFsAccess>();
|
||||
pFsAccessOriginal = pLinuxSysmanImp->pFsAccess;
|
||||
|
||||
@@ -32,10 +32,6 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
|
||||
pOriginalKmdSysManager = pWddmSysmanImp->pKmdSysManager;
|
||||
pWddmSysmanImp->pKmdSysManager = pKmdSysManager.get();
|
||||
|
||||
for (auto handle : pSysmanDeviceImp->pTempHandleContext->handleList) {
|
||||
delete handle;
|
||||
}
|
||||
|
||||
pSysmanDeviceImp->pTempHandleContext->handleList.clear();
|
||||
uint32_t subDeviceCount = 0;
|
||||
// We received a device handle. Check for subdevices in this device
|
||||
|
||||
Reference in New Issue
Block a user