Merge pull request #9222 from alexstrat/add-os-process-id
Add OS pid to web-contents
This commit is contained in:
commit
d79ac8d9c1
4 changed files with 27 additions and 0 deletions
|
@ -41,6 +41,7 @@
|
|||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
#include "base/process/process_handle.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "brightray/browser/inspectable_web_contents.h"
|
||||
|
@ -1007,6 +1008,11 @@ int WebContents::GetProcessID() const {
|
|||
return web_contents()->GetRenderProcessHost()->GetID();
|
||||
}
|
||||
|
||||
int WebContents::GetOSProcessID() const {
|
||||
auto process_handle = web_contents()->GetRenderProcessHost()->GetHandle();
|
||||
return base::GetProcId(process_handle);
|
||||
}
|
||||
|
||||
WebContents::Type WebContents::GetType() const {
|
||||
return type_;
|
||||
}
|
||||
|
@ -1754,6 +1760,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
|||
.MakeDestroyable()
|
||||
.SetMethod("getId", &WebContents::GetID)
|
||||
.SetMethod("getProcessId", &WebContents::GetProcessID)
|
||||
.SetMethod("getOSProcessId", &WebContents::GetOSProcessID)
|
||||
.SetMethod("equal", &WebContents::Equal)
|
||||
.SetMethod("_loadURL", &WebContents::LoadURL)
|
||||
.SetMethod("downloadURL", &WebContents::DownloadURL)
|
||||
|
|
|
@ -83,6 +83,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
|
||||
int64_t GetID() const;
|
||||
int GetProcessID() const;
|
||||
int GetOSProcessID() const;
|
||||
Type GetType() const;
|
||||
bool Equal(const WebContents* web_contents) const;
|
||||
void LoadURL(const GURL& url, const mate::Dictionary& options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue