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

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: Fix typos 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 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 1468
1469 scoped_refptr<SiteInstance> site_instance = 1469 scoped_refptr<SiteInstance> site_instance =
1470 params.opener_suppressed && !is_guest ? 1470 params.opener_suppressed && !is_guest ?
1471 SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) : 1471 SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) :
1472 GetSiteInstance(); 1472 GetSiteInstance();
1473 1473
1474 // A message to create a new window can only come from the active process for 1474 // A message to create a new window can only come from the active process for
1475 // this WebContentsImpl instance. If any other process sends the request, 1475 // this WebContentsImpl instance. If any other process sends the request,
1476 // it is invalid and the process must be terminated. 1476 // it is invalid and the process must be terminated.
1477 if (GetRenderProcessHost()->GetID() != render_process_id) { 1477 if (GetRenderProcessHost()->GetID() != render_process_id) {
1478 base::ProcessHandle process_handle = 1478 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id);
1479 RenderProcessHost::FromID(render_process_id)->GetHandle(); 1479 base::ProcessHandle process_handle = rph->GetHandle();
1480 if (process_handle != base::kNullProcessHandle) { 1480 if (process_handle != base::kNullProcessHandle) {
1481 RecordAction( 1481 RecordAction(
1482 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWindow")); 1482 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWindow"));
1483 base::KillProcess(process_handle, RESULT_CODE_KILLED, false); 1483 rph->FastShutdown(RESULT_CODE_KILLED, false);
1484 } 1484 }
1485 return; 1485 return;
1486 } 1486 }
1487 1487
1488 // We must assign the SessionStorageNamespace before calling Init(). 1488 // We must assign the SessionStorageNamespace before calling Init().
1489 // 1489 //
1490 // http://crbug.com/142685 1490 // http://crbug.com/142685
1491 const std::string& partition_id = 1491 const std::string& partition_id =
1492 GetContentClient()->browser()-> 1492 GetContentClient()->browser()->
1493 GetStoragePartitionIdForSite(GetBrowserContext(), 1493 GetStoragePartitionIdForSite(GetBrowserContext(),
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 1602
1603 void WebContentsImpl::CreateNewWidget(int render_process_id, 1603 void WebContentsImpl::CreateNewWidget(int render_process_id,
1604 int route_id, 1604 int route_id,
1605 bool is_fullscreen, 1605 bool is_fullscreen,
1606 blink::WebPopupType popup_type) { 1606 blink::WebPopupType popup_type) {
1607 RenderProcessHost* process = GetRenderProcessHost(); 1607 RenderProcessHost* process = GetRenderProcessHost();
1608 // A message to create a new widget can only come from the active process for 1608 // A message to create a new widget can only come from the active process for
1609 // this WebContentsImpl instance. If any other process sends the request, 1609 // this WebContentsImpl instance. If any other process sends the request,
1610 // it is invalid and the process must be terminated. 1610 // it is invalid and the process must be terminated.
1611 if (process->GetID() != render_process_id) { 1611 if (process->GetID() != render_process_id) {
1612 base::ProcessHandle process_handle = 1612 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id);
1613 RenderProcessHost::FromID(render_process_id)->GetHandle(); 1613 base::ProcessHandle process_handle = rph->GetHandle();
1614 if (process_handle != base::kNullProcessHandle) { 1614 if (process_handle != base::kNullProcessHandle) {
1615 RecordAction( 1615 RecordAction(
1616 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); 1616 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget"));
1617 base::KillProcess(process_handle, RESULT_CODE_KILLED, false); 1617 rph->FastShutdown(RESULT_CODE_KILLED, false);
1618 } 1618 }
1619 return; 1619 return;
1620 } 1620 }
1621 1621
1622 RenderWidgetHostImpl* widget_host = 1622 RenderWidgetHostImpl* widget_host =
1623 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); 1623 new RenderWidgetHostImpl(this, process, route_id, IsHidden());
1624 created_widgets_.insert(widget_host); 1624 created_widgets_.insert(widget_host);
1625 1625
1626 RenderWidgetHostViewBase* widget_view = 1626 RenderWidgetHostViewBase* widget_view =
1627 static_cast<RenderWidgetHostViewBase*>( 1627 static_cast<RenderWidgetHostViewBase*>(
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after
4353 node->render_manager()->ResumeResponseDeferredAtStart(); 4353 node->render_manager()->ResumeResponseDeferredAtStart();
4354 } 4354 }
4355 4355
4356 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4356 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4357 force_disable_overscroll_content_ = force_disable; 4357 force_disable_overscroll_content_ = force_disable;
4358 if (view_) 4358 if (view_)
4359 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4359 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4360 } 4360 }
4361 4361
4362 } // namespace content 4362 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698