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

Side by Side Diff: content/public/test/mock_render_process_host.cc

Issue 2921063003: Fix process reuse for dedicated processes when over process limit. (Closed)
Patch Set: Fix IsSuitableHost for sites that require a dedicated process but don't set an origin lock Created 3 years, 6 months 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/public/test/mock_render_process_host.h" 5 #include "content/public/test/mock_render_process_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 28 matching lines...) Expand all
39 : bad_msg_count_(0), 39 : bad_msg_count_(0),
40 factory_(NULL), 40 factory_(NULL),
41 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), 41 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
42 has_connection_(false), 42 has_connection_(false),
43 browser_context_(browser_context), 43 browser_context_(browser_context),
44 prev_routing_id_(0), 44 prev_routing_id_(0),
45 fast_shutdown_started_(false), 45 fast_shutdown_started_(false),
46 deletion_callback_called_(false), 46 deletion_callback_called_(false),
47 is_for_guests_only_(false), 47 is_for_guests_only_(false),
48 is_process_backgrounded_(false), 48 is_process_backgrounded_(false),
49 is_unused_(true),
49 worker_ref_count_(0), 50 worker_ref_count_(0),
50 weak_ptr_factory_(this) { 51 weak_ptr_factory_(this) {
51 // Child process security operations can't be unit tested unless we add 52 // Child process security operations can't be unit tested unless we add
52 // ourselves as an existing child process. 53 // ourselves as an existing child process.
53 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); 54 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
54 55
55 RenderProcessHostImpl::RegisterHost(GetID(), this); 56 RenderProcessHostImpl::RegisterHost(GetID(), this);
56 } 57 }
57 58
58 MockRenderProcessHost::~MockRenderProcessHost() { 59 MockRenderProcessHost::~MockRenderProcessHost() {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 352 }
352 353
353 void MockRenderProcessHost::SetIsNeverSuitableForReuse() { 354 void MockRenderProcessHost::SetIsNeverSuitableForReuse() {
354 NOTREACHED(); 355 NOTREACHED();
355 } 356 }
356 357
357 bool MockRenderProcessHost::MayReuseHost() { 358 bool MockRenderProcessHost::MayReuseHost() {
358 return true; 359 return true;
359 } 360 }
360 361
362 bool MockRenderProcessHost::IsUnused() {
363 return is_unused_;
364 }
365
366 void MockRenderProcessHost::SetIsUsed() {
367 is_unused_ = false;
368 }
369
361 void MockRenderProcessHost::FilterURL(bool empty_allowed, GURL* url) { 370 void MockRenderProcessHost::FilterURL(bool empty_allowed, GURL* url) {
362 RenderProcessHostImpl::FilterURL(this, empty_allowed, url); 371 RenderProcessHostImpl::FilterURL(this, empty_allowed, url);
363 } 372 }
364 373
365 #if BUILDFLAG(ENABLE_WEBRTC) 374 #if BUILDFLAG(ENABLE_WEBRTC)
366 void MockRenderProcessHost::EnableAudioDebugRecordings( 375 void MockRenderProcessHost::EnableAudioDebugRecordings(
367 const base::FilePath& file) { 376 const base::FilePath& file) {
368 } 377 }
369 378
370 void MockRenderProcessHost::DisableAudioDebugRecordings() {} 379 void MockRenderProcessHost::DisableAudioDebugRecordings() {}
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 for (auto it = processes_.begin(); it != processes_.end(); ++it) { 444 for (auto it = processes_.begin(); it != processes_.end(); ++it) {
436 if (it->get() == host) { 445 if (it->get() == host) {
437 it->release(); 446 it->release();
438 processes_.erase(it); 447 processes_.erase(it);
439 break; 448 break;
440 } 449 }
441 } 450 }
442 } 451 }
443 452
444 } // namespace content 453 } // namespace content
OLDNEW
« content/browser/site_instance_impl.cc ('K') | « content/public/test/mock_render_process_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698