🎨 Minor formatting/doc changes

This commit is contained in:
Kevin Sawicki 2017-05-26 07:51:17 -07:00
parent c4e5ba6015
commit b5879b7399
5 changed files with 31 additions and 36 deletions

View file

@ -679,26 +679,20 @@ void App::OnGpuProcessCrashed(base::TerminationStatus status) {
void App::BrowserChildProcessLaunchedAndConnected(
const content::ChildProcessData& data) {
this->ChildProcessLaunched(
data.process_type,
data.handle);
ChildProcessLaunched(data.process_type, data.handle);
}
void App::BrowserChildProcessHostDisconnected(
const content::ChildProcessData& data) {
this->ChildProcessDisconnected(base::GetProcId(data.handle));
ChildProcessDisconnected(base::GetProcId(data.handle));
}
void App::RenderProcessReady(
content::RenderProcessHost* host) {
this->ChildProcessLaunched(
content::PROCESS_TYPE_RENDERER,
host->GetHandle());
void App::RenderProcessReady(content::RenderProcessHost* host) {
ChildProcessLaunched(content::PROCESS_TYPE_RENDERER, host->GetHandle());
}
void App::RenderProcessDisconnected(
content::RenderProcessHost* host) {
this->ChildProcessDisconnected(base::GetProcId(host->GetHandle()));
void App::RenderProcessDisconnected(content::RenderProcessHost* host) {
ChildProcessDisconnected(base::GetProcId(host->GetHandle()));
}
void App::ChildProcessLaunched(
@ -722,8 +716,7 @@ void App::ChildProcessLaunched(
app_metrics_[pid] = std::move(process_metric);
}
void App::ChildProcessDisconnected(
base::ProcessId pid) {
void App::ChildProcessDisconnected(base::ProcessId pid) {
app_metrics_.erase(pid);
}
@ -1095,9 +1088,9 @@ void App::BuildPrototype(
.SetMethod("disableHardwareAcceleration",
&App::DisableHardwareAcceleration)
.SetMethod("getFileIcon", &App::GetFileIcon)
// TODO(juturu): Deprecate getAppMemoryInfo.
.SetMethod("getAppMemoryInfo", &App::GetAppMetrics)
.SetMethod("getAppMetrics", &App::GetAppMetrics);
.SetMethod("getAppMetrics", &App::GetAppMetrics)
// TODO(juturu): Remove in 2.0, deprecate before then with warnings
.SetMethod("getAppMemoryInfo", &App::GetAppMetrics);
}
} // namespace api

View file

@ -6,6 +6,7 @@
#define ATOM_BROWSER_API_ATOM_API_APP_H_
#include <string>
#include <utility>
#include <vector>
#include "atom/browser/api/event_emitter.h"
@ -46,7 +47,8 @@ struct ProcessMetric {
std::string type;
base::ProcessId pid;
std::unique_ptr<base::ProcessMetrics> metrics;
ProcessMetric(std::string type,
ProcessMetric(const std::string& type,
base::ProcessId pid,
std::unique_ptr<base::ProcessMetrics> metrics) {
this->type = type;

View file

@ -413,8 +413,7 @@ void AtomBrowserClient::RenderProcessHostDestroyed(
}
}
void AtomBrowserClient::RenderProcessReady(
content::RenderProcessHost* host) {
void AtomBrowserClient::RenderProcessReady(content::RenderProcessHost* host) {
if (delegate_) {
static_cast<api::App*>(delegate_)->RenderProcessReady(host);
}

View file

@ -762,9 +762,10 @@ Disables hardware acceleration for current app.
This method can only be called before app is ready.
### `app.getAppMemoryInfo()` _Deprecate_
### `app.getAppMemoryInfo()` _Deprecated_
Returns [ProcessMetric[]](structures/process-metric.md): Array of `ProcessMetric` objects that correspond to memory and cpu usage statistics of all the processes associated with the app.
**Note:** This method is deprecated, use `app.getAppMetrics()` instead.
### `app.getAppMetrics()`

View file

@ -535,7 +535,7 @@ describe('app module', function () {
})
describe('getAppMetrics() API', function () {
it('returns the process memory of all running electron processes', function () {
it('returns memory and cpu stats of all running electron processes', function () {
const appMetrics = app.getAppMetrics()
assert.ok(appMetrics.length > 0, 'App memory info object is not > 0')
for (const {memory, pid, type, cpu} of appMetrics) {