Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 740813004: Use StopChildProcess instead of base::KillProcess to kill a renderer process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 1465
1466 scoped_refptr<SiteInstance> site_instance = 1466 scoped_refptr<SiteInstance> site_instance =
1467 params.opener_suppressed && !is_guest ? 1467 params.opener_suppressed && !is_guest ?
1468 SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) : 1468 SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) :
1469 GetSiteInstance(); 1469 GetSiteInstance();
1470 1470
1471 // A message to create a new window can only come from the active process for 1471 // A message to create a new window can only come from the active process for
1472 // this WebContentsImpl instance. If any other process sends the request, 1472 // this WebContentsImpl instance. If any other process sends the request,
1473 // it is invalid and the process must be terminated. 1473 // it is invalid and the process must be terminated.
1474 if (GetRenderProcessHost()->GetID() != render_process_id) { 1474 if (GetRenderProcessHost()->GetID() != render_process_id) {
1475 base::ProcessHandle process_handle = 1475 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id);
1476 RenderProcessHost::FromID(render_process_id)->GetHandle(); 1476 base::ProcessHandle process_handle = rph->GetHandle();
1477 if (process_handle != base::kNullProcessHandle) { 1477 if (process_handle != base::kNullProcessHandle) {
1478 RecordAction( 1478 RecordAction(
1479 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWindow")); 1479 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWindow"));
1480 base::KillProcess(process_handle, RESULT_CODE_KILLED, false); 1480 rph->Shutdown(RESULT_CODE_KILLED, false);
1481 } 1481 }
1482 return; 1482 return;
1483 } 1483 }
1484 1484
1485 // We must assign the SessionStorageNamespace before calling Init(). 1485 // We must assign the SessionStorageNamespace before calling Init().
1486 // 1486 //
1487 // http://crbug.com/142685 1487 // http://crbug.com/142685
1488 const std::string& partition_id = 1488 const std::string& partition_id =
1489 GetContentClient()->browser()-> 1489 GetContentClient()->browser()->
1490 GetStoragePartitionIdForSite(GetBrowserContext(), 1490 GetStoragePartitionIdForSite(GetBrowserContext(),
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1599
1600 void WebContentsImpl::CreateNewWidget(int render_process_id, 1600 void WebContentsImpl::CreateNewWidget(int render_process_id,
1601 int route_id, 1601 int route_id,
1602 bool is_fullscreen, 1602 bool is_fullscreen,
1603 blink::WebPopupType popup_type) { 1603 blink::WebPopupType popup_type) {
1604 RenderProcessHost* process = GetRenderProcessHost(); 1604 RenderProcessHost* process = GetRenderProcessHost();
1605 // A message to create a new widget can only come from the active process for 1605 // A message to create a new widget can only come from the active process for
1606 // this WebContentsImpl instance. If any other process sends the request, 1606 // this WebContentsImpl instance. If any other process sends the request,
1607 // it is invalid and the process must be terminated. 1607 // it is invalid and the process must be terminated.
1608 if (process->GetID() != render_process_id) { 1608 if (process->GetID() != render_process_id) {
1609 base::ProcessHandle process_handle = 1609 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id);
1610 RenderProcessHost::FromID(render_process_id)->GetHandle(); 1610 base::ProcessHandle process_handle = rph->GetHandle();
1611 if (process_handle != base::kNullProcessHandle) { 1611 if (process_handle != base::kNullProcessHandle) {
1612 RecordAction( 1612 RecordAction(
1613 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); 1613 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget"));
1614 base::KillProcess(process_handle, RESULT_CODE_KILLED, false); 1614 rph->Shutdown(RESULT_CODE_KILLED, false);
1615 } 1615 }
1616 return; 1616 return;
1617 } 1617 }
1618 1618
1619 RenderWidgetHostImpl* widget_host = 1619 RenderWidgetHostImpl* widget_host =
1620 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); 1620 new RenderWidgetHostImpl(this, process, route_id, IsHidden());
1621 created_widgets_.insert(widget_host); 1621 created_widgets_.insert(widget_host);
1622 1622
1623 RenderWidgetHostViewBase* widget_view = 1623 RenderWidgetHostViewBase* widget_view =
1624 static_cast<RenderWidgetHostViewBase*>( 1624 static_cast<RenderWidgetHostViewBase*>(
(...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after
4356 node->render_manager()->ResumeResponseDeferredAtStart(); 4356 node->render_manager()->ResumeResponseDeferredAtStart();
4357 } 4357 }
4358 4358
4359 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4359 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4360 force_disable_overscroll_content_ = force_disable; 4360 force_disable_overscroll_content_ = force_disable;
4361 if (view_) 4361 if (view_)
4362 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4362 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4363 } 4363 }
4364 4364
4365 } // namespace content 4365 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/public/browser/render_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698