GetRenderProcessHost() has been removed for OOPI support, should use #include GetMainFrame()->GetProcess()

This commit is contained in:
Samuel Attard 2017-12-18 13:46:23 +11:00 committed by Aleksei Kuzmin
parent c3dec709ab
commit a8e013dcb6
4 changed files with 17 additions and 10 deletions

View file

@ -1041,7 +1041,7 @@ void WebContents::NavigationEntryCommitted(
}
int64_t WebContents::GetIDForContents(content::WebContents* web_contents) {
int64_t process_id = web_contents->GetRenderProcessHost()->GetID();
int64_t process_id = web_contents->GetMainFrame()->GetProcess()->GetID();
int64_t routing_id = web_contents->GetMainFrame()->GetRoutingID();
int64_t rv = (process_id << 32) + routing_id;
return rv;
@ -1052,11 +1052,12 @@ int64_t WebContents::GetID() const {
}
int WebContents::GetProcessID() const {
return web_contents()->GetRenderProcessHost()->GetID();
return web_contents()->GetMainFrame()->GetProcess()->GetID();
}
base::ProcessId WebContents::GetOSProcessID() const {
auto process_handle = web_contents()->GetRenderProcessHost()->GetHandle();
auto process_handle =
web_contents()->GetMainFrame()->GetProcess()->GetHandle();
return base::GetProcId(process_handle);
}

View file

@ -97,7 +97,7 @@ content::WebContents* WebContentsPreferences::GetWebContentsFromProcessID(
int process_id) {
for (WebContentsPreferences* preferences : instances_) {
content::WebContents* web_contents = preferences->web_contents_;
if (web_contents->GetRenderProcessHost()->GetID() == process_id)
if (web_contents->GetMainFrame()->GetProcess()->GetID() == process_id)
return web_contents;
}
return nullptr;

View file

@ -7,6 +7,7 @@
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@ -53,7 +54,8 @@ void WebContentsZoomController::SetZoomLevel(double level) {
zoom_mode_ == ZOOM_MODE_DISABLED)
return;
int render_process_id = web_contents()->GetRenderProcessHost()->GetID();
int render_process_id =
web_contents()->GetRenderViewHost()->GetProcess()->GetID();
int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID();
if (zoom_mode_ == ZOOM_MODE_MANUAL) {
@ -98,7 +100,7 @@ double WebContentsZoomController::GetDefaultZoomFactor() {
}
void WebContentsZoomController::SetTemporaryZoomLevel(double level) {
old_process_id_ = web_contents()->GetRenderProcessHost()->GetID();
old_process_id_ = web_contents()->GetRenderViewHost()->GetProcess()->GetID();
old_view_id_ = web_contents()->GetRenderViewHost()->GetRoutingID();
host_zoom_map_->SetTemporaryZoomLevel(old_process_id_, old_view_id_, level);
// Notify observers of zoom level changes.
@ -107,7 +109,8 @@ void WebContentsZoomController::SetTemporaryZoomLevel(double level) {
}
bool WebContentsZoomController::UsesTemporaryZoomLevel() {
int render_process_id = web_contents()->GetRenderProcessHost()->GetID();
int render_process_id =
web_contents()->GetRenderViewHost()->GetProcess()->GetID();
int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID();
return host_zoom_map_->UsesTemporaryZoomLevel(render_process_id,
render_view_id);
@ -120,7 +123,8 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) {
content::HostZoomMap* zoom_map =
content::HostZoomMap::GetForWebContents(web_contents());
int render_process_id = web_contents()->GetRenderProcessHost()->GetID();
int render_process_id =
web_contents()->GetRenderViewHost()->GetProcess()->GetID();
int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID();
double original_zoom_level = GetZoomLevel();
@ -203,7 +207,8 @@ void WebContentsZoomController::ResetZoomModeOnNavigationIfNeeded(
if (zoom_mode_ != ZOOM_MODE_ISOLATED && zoom_mode_ != ZOOM_MODE_MANUAL)
return;
int render_process_id = web_contents()->GetRenderProcessHost()->GetID();
int render_process_id =
web_contents()->GetRenderViewHost()->GetProcess()->GetID();
int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID();
content::HostZoomMap* zoom_map =
content::HostZoomMap::GetForWebContents(web_contents());

View file

@ -5,6 +5,7 @@
#include "atom/browser/web_view_manager.h"
#include "atom/browser/atom_browser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
@ -23,7 +24,7 @@ void WebViewManager::AddGuest(int guest_instance_id,
web_contents_embedder_map_[guest_instance_id] = { web_contents, embedder };
// Map the element in embedder to guest.
int owner_process_id = embedder->GetRenderProcessHost()->GetID();
int owner_process_id = embedder->GetMainFrame()->GetProcess()->GetID();
ElementInstanceKey key(owner_process_id, element_instance_id);
element_instance_id_to_guest_map_[key] = guest_instance_id;
}