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

Side by Side Diff: extensions/browser/guest_view/guest_view_manager.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/guest_view/guest_view_manager.h" 5 #include "extensions/browser/guest_view/guest_view_manager.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 282
283 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( 283 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill(
284 int embedder_render_process_id, 284 int embedder_render_process_id,
285 int guest_instance_id) { 285 int guest_instance_id) {
286 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, 286 if (!CanEmbedderAccessInstanceID(embedder_render_process_id,
287 guest_instance_id)) { 287 guest_instance_id)) {
288 // The embedder process is trying to access a guest it does not own. 288 // The embedder process is trying to access a guest it does not own.
289 content::RecordAction( 289 content::RecordAction(
290 base::UserMetricsAction("BadMessageTerminate_BPGM")); 290 base::UserMetricsAction("BadMessageTerminate_BPGM"));
291 base::KillProcess( 291 content::RenderProcessHost::FromID(embedder_render_process_id)
292 content::RenderProcessHost::FromID(embedder_render_process_id)-> 292 ->Shutdown(content::RESULT_CODE_KILLED_BAD_MESSAGE, false);
293 GetHandle(),
294 content::RESULT_CODE_KILLED_BAD_MESSAGE, false);
295 return false; 293 return false;
296 } 294 }
297 return true; 295 return true;
298 } 296 }
299 297
300 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { 298 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) {
301 if (guest_instance_id <= last_instance_id_removed_) 299 if (guest_instance_id <= last_instance_id_removed_)
302 return false; 300 return false;
303 return !ContainsKey(removed_instance_ids_, guest_instance_id); 301 return !ContainsKey(removed_instance_ids_, guest_instance_id);
304 } 302 }
(...skipping 21 matching lines...) Expand all
326 return true; 324 return true;
327 325
328 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second); 326 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second);
329 if (!guest_view) 327 if (!guest_view)
330 return false; 328 return false;
331 329
332 return embedder_render_process_id == guest_view->owner_render_process_id(); 330 return embedder_render_process_id == guest_view->owner_render_process_id();
333 } 331 }
334 332
335 } // namespace extensions 333 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698