X Tutup
Skip to content

Commit dde194d

Browse files
MarshallOfSoundalexeykuzmin
authored andcommitted
Remove the memory property from getAppMetrics
See electron@03d0bfd for more information
1 parent 14df89f commit dde194d

File tree

5 files changed

+4
-35
lines changed

5 files changed

+4
-35
lines changed

atom/browser/api/atom_api_app.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,30 +1112,11 @@ std::vector<mate::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
11121112

11131113
for (const auto& process_metric : app_metrics_) {
11141114
mate::Dictionary pid_dict = mate::Dictionary::CreateEmpty(isolate);
1115-
mate::Dictionary memory_dict = mate::Dictionary::CreateEmpty(isolate);
11161115
mate::Dictionary cpu_dict = mate::Dictionary::CreateEmpty(isolate);
11171116

11181117
pid_dict.SetHidden("simple", true);
1119-
memory_dict.SetHidden("simple", true);
11201118
cpu_dict.SetHidden("simple", true);
11211119

1122-
memory_dict.Set(
1123-
"workingSetSize",
1124-
static_cast<double>(
1125-
process_metric.second->metrics->GetWorkingSetSize() >> 10));
1126-
memory_dict.Set(
1127-
"peakWorkingSetSize",
1128-
static_cast<double>(
1129-
process_metric.second->metrics->GetPeakWorkingSetSize() >> 10));
1130-
1131-
size_t private_bytes, shared_bytes;
1132-
if (process_metric.second->metrics->GetMemoryBytes(&private_bytes,
1133-
&shared_bytes)) {
1134-
memory_dict.Set("privateBytes", static_cast<double>(private_bytes >> 10));
1135-
memory_dict.Set("sharedBytes", static_cast<double>(shared_bytes >> 10));
1136-
}
1137-
1138-
pid_dict.Set("memory", memory_dict);
11391120
cpu_dict.Set(
11401121
"percentCPUUsage",
11411122
process_metric.second->metrics->GetPlatformIndependentCPUUsage() /

docs/api/breaking-changes.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ app.getAppMetrics()
4949

5050
// Deprecated
5151
const metrics = app.getAppMetrics()
52-
const {memory} = metrics[0]
53-
memory.privateBytes // Deprecated property
54-
memory.sharedBytes // Deprecated property
52+
const {memory} = metrics[0] // Deprecated property
5553
```
5654

5755
## `BrowserWindow`

docs/api/structures/process-metric.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
* `pid` Integer - Process id of the process.
44
* `type` String - Process type (Browser or Tab or GPU etc).
5-
* `memory` [MemoryInfo](memory-info.md) - Memory information for the process.
65
* `cpu` [CPUUsage](cpu-usage.md) - CPU usage of the process.

lib/browser/api/app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ Object.assign(app, {
4343
const nativeFn = app.getAppMetrics
4444
app.getAppMetrics = () => {
4545
let metrics = nativeFn.call(app)
46-
for (const {memory} of metrics) {
47-
deprecate.removeProperty(memory, 'privateBytes')
48-
deprecate.removeProperty(memory, 'sharedBytes')
46+
for (const metric of metrics) {
47+
deprecate.removeProperty(metric, 'memory')
4948
}
5049

5150
return metrics

spec/api-app-spec.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -786,15 +786,7 @@ describe('app module', () => {
786786
expect(appMetrics).to.be.an('array').and.have.lengthOf.at.least(1, 'App memory info object is not > 0')
787787

788788
const types = []
789-
for (const {memory, pid, type, cpu} of appMetrics) {
790-
expect(memory.workingSetSize).to.be.above(0, 'working set size is not > 0')
791-
792-
// windows causes failures here due to CI server configuration
793-
if (process.platform !== 'win32') {
794-
expect(memory.privateBytes).to.be.above(0, 'private bytes is not > 0')
795-
expect(memory.sharedBytes).to.be.above(0, 'shared bytes is not > 0')
796-
}
797-
789+
for (const {pid, type, cpu} of appMetrics) {
798790
expect(pid).to.be.above(0, 'pid is not > 0')
799791
expect(type).to.be.a('string').that.is.not.empty()
800792

0 commit comments

Comments
 (0)
X Tutup