fix: gin_helper::Promise in GPUInfoManager must be destroyed before destroying Node/V8 (#46470)
* fix: gin_helper::Promise in GPUInfoManager must be destroyed before destroying Node/V8 Co-authored-by: Yang Liu <ouyangliu.leo@gmail.com> * fix: use CleanedUpAtExit to control the lifetime of GPUInfoManager Co-authored-by: Yang Liu <ouyangliu.leo@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Yang Liu <ouyangliu.leo@gmail.com>
This commit is contained in:
parent
69a38fa5aa
commit
e4554f9536
2 changed files with 6 additions and 2 deletions
|
@ -17,7 +17,9 @@
|
|||
namespace electron {
|
||||
|
||||
GPUInfoManager* GPUInfoManager::GetInstance() {
|
||||
return base::Singleton<GPUInfoManager>::get();
|
||||
// will be deleted by CleanedUpAtExit::DoCleanup
|
||||
static GPUInfoManager* instance = new GPUInfoManager();
|
||||
return instance;
|
||||
}
|
||||
|
||||
GPUInfoManager::GPUInfoManager()
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "content/browser/gpu/gpu_data_manager_impl.h" // nogncheck
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/gpu_data_manager_observer.h"
|
||||
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
|
||||
|
||||
namespace gin_helper {
|
||||
template <typename T>
|
||||
|
@ -20,7 +21,8 @@ class Promise;
|
|||
namespace electron {
|
||||
|
||||
// GPUInfoManager is a singleton used to manage and fetch GPUInfo
|
||||
class GPUInfoManager : private content::GpuDataManagerObserver {
|
||||
class GPUInfoManager : private content::GpuDataManagerObserver,
|
||||
public gin_helper::CleanedUpAtExit {
|
||||
public:
|
||||
static GPUInfoManager* GetInstance();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue