refactor: add gin_helper::Dictionary::CreateEmpty() helper (#39547)
This commit is contained in:
parent
9937a2bbe8
commit
09190085c0
29 changed files with 66 additions and 64 deletions
|
@ -139,7 +139,7 @@ v8::Local<v8::Value> ElectronBindings::GetHeapStatistics(v8::Isolate* isolate) {
|
|||
v8::HeapStatistics v8_heap_stats;
|
||||
isolate->GetHeapStatistics(&v8_heap_stats);
|
||||
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
dict.Set("totalHeapSize",
|
||||
static_cast<double>(v8_heap_stats.total_heap_size() >> 10));
|
||||
|
@ -184,7 +184,7 @@ v8::Local<v8::Value> ElectronBindings::GetSystemMemoryInfo(
|
|||
return v8::Undefined(isolate);
|
||||
}
|
||||
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
dict.Set("total", mem_info.total);
|
||||
|
||||
|
@ -235,7 +235,7 @@ v8::Local<v8::Value> ElectronBindings::GetBlinkMemoryInfo(
|
|||
auto allocated = blink::ProcessHeap::TotalAllocatedObjectSize();
|
||||
auto total = blink::ProcessHeap::TotalAllocatedSpace();
|
||||
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
dict.Set("allocated", static_cast<double>(allocated >> 10));
|
||||
dict.Set("total", static_cast<double>(total >> 10));
|
||||
|
@ -266,7 +266,7 @@ void ElectronBindings::DidReceiveMemoryDump(
|
|||
for (const memory_instrumentation::GlobalMemoryDump::ProcessDump& dump :
|
||||
global_dump->process_dumps()) {
|
||||
if (target_pid == dump.pid()) {
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
const auto& osdump = dump.os_dump();
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
|
||||
dict.Set("residentSet", osdump.resident_set_kb);
|
||||
|
@ -288,7 +288,7 @@ void ElectronBindings::DidReceiveMemoryDump(
|
|||
v8::Local<v8::Value> ElectronBindings::GetCPUUsage(
|
||||
base::ProcessMetrics* metrics,
|
||||
v8::Isolate* isolate) {
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
int processor_count = base::SysInfo::NumberOfProcessors();
|
||||
dict.Set("percentCPUUsage",
|
||||
|
@ -309,7 +309,7 @@ v8::Local<v8::Value> ElectronBindings::GetCPUUsage(
|
|||
v8::Local<v8::Value> ElectronBindings::GetIOCounters(v8::Isolate* isolate) {
|
||||
auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics();
|
||||
base::IoCounters io_counters;
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
|
||||
if (metrics->GetIOCounters(&io_counters)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue