From 350528707bb4ca11e9c008a3e6fab829a4b74d3e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 May 2017 13:29:34 -0700 Subject: [PATCH 1/3] Return base::ProcessId --- atom/browser/api/atom_api_web_contents.cc | 2 +- atom/browser/api/atom_api_web_contents.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 5afecfedd2de..84773aff1cb4 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1008,7 +1008,7 @@ int WebContents::GetProcessID() const { return web_contents()->GetRenderProcessHost()->GetID(); } -int WebContents::GetOSProcessID() const { +base::ProcessId WebContents::GetOSProcessID() const { auto process_handle = web_contents()->GetRenderProcessHost()->GetHandle(); return base::GetProcId(process_handle); } diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 9549950dd428..9c6ffa4f8fd1 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -83,7 +83,7 @@ class WebContents : public mate::TrackableObject, int64_t GetID() const; int GetProcessID() const; - int GetOSProcessID() const; + base::ProcessId GetOSProcessID() const; Type GetType() const; bool Equal(const WebContents* web_contents) const; void LoadURL(const GURL& url, const mate::Dictionary& options); From 0ae5f7e62354e2758dbbe2614fefa808f31a6cc1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 May 2017 13:34:30 -0700 Subject: [PATCH 2/3] Assert PID is 0 with no URL --- spec/api-web-contents-spec.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/spec/api-web-contents-spec.js b/spec/api-web-contents-spec.js index 92cbd2bfaf51..186a6458b172 100644 --- a/spec/api-web-contents-spec.js +++ b/spec/api-web-contents-spec.js @@ -326,14 +326,10 @@ describe('webContents module', function () { describe('getOSProcessId()', function () { it('returns a valid procress id', function () { - // load URL otherwise getOSProcessId() returns 0 - w.loadURL('file://' + path.join(__dirname, 'fixtures', 'pages', 'focus-web-contents.html')) + assert.strictEqual(w.webContents.getOSProcessId(), 0) - const specWebContents = w.webContents - let pid = null - assert.doesNotThrow(function () { - pid = specWebContents.getOSProcessId() - }) + w.loadURL('about:blank') + const pid = w.webContents.getOSProcessId() assert(typeof pid === 'number', 'is a number') assert(pid > 0, 'superior to 0') }) From 4f99cb19bdb54ee2c4f2522d07a1de81f7ded56a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 May 2017 13:38:57 -0700 Subject: [PATCH 3/3] :fire: ; --- docs/api/desktop-capturer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/desktop-capturer.md b/docs/api/desktop-capturer.md index 5cc233e6cd92..5f11d94561f6 100644 --- a/docs/api/desktop-capturer.md +++ b/docs/api/desktop-capturer.md @@ -63,7 +63,7 @@ const constraints = { chromeMediaSource: 'desktop' } } -}; +} ``` ## Methods @@ -75,7 +75,7 @@ The `desktopCapturer` module has the following methods: * `options` Object * `types` String[] - An array of Strings that lists the types of desktop sources to be captured, available types are `screen` and `window`. - * `thumbnailSize` [Size](structures/size.md) (optional) - The size that the media source thumbnail + * `thumbnailSize` [Size](structures/size.md) (optional) - The size that the media source thumbnail should be scaled to. Default is `150` x `150`. * `callback` Function * `error` Error