 Chromium Code Reviews
 Chromium Code Reviews Issue 2793623002:
  android: Limit num renderer to service slots  (Closed)
    
  
    Issue 2793623002:
  android: Limit num renderer to service slots  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> | 
| 6 | 6 | 
| 7 #include <limits> | 7 #include <limits> | 
| 8 #include <memory> | 8 #include <memory> | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 EXPECT_TRUE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost( | 63 EXPECT_TRUE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost( | 
| 64 browser_context(), test_url)); | 64 browser_context(), test_url)); | 
| 65 } | 65 } | 
| 66 #endif | 66 #endif | 
| 67 | 67 | 
| 68 #if defined(OS_ANDROID) | 68 #if defined(OS_ANDROID) | 
| 69 TEST_F(RenderProcessHostUnitTest, NoRendererProcessLimitOnAndroid) { | 69 TEST_F(RenderProcessHostUnitTest, NoRendererProcessLimitOnAndroid) { | 
| 70 // Disable any overrides. | 70 // Disable any overrides. | 
| 71 RenderProcessHostImpl::SetMaxRendererProcessCount(0); | 71 RenderProcessHostImpl::SetMaxRendererProcessCount(0); | 
| 72 | 72 | 
| 73 // Verify that by default the limit on Android returns max size_t. | |
| 
Jay Civelli
2017/04/03 16:19:48
Should we add a TODO to bring that test back if/wh
 
boliu
2017/04/03 16:33:03
I think this is a really dumb check and should not
 
Jay Civelli
2017/04/03 16:40:50
Makes sense.
 | |
| 74 EXPECT_EQ(std::numeric_limits<size_t>::max(), | |
| 75 RenderProcessHostImpl::GetMaxRendererProcessCount()); | |
| 76 | |
| 77 // Add a few dummy process hosts. | 73 // Add a few dummy process hosts. | 
| 78 ASSERT_NE(0u, kMaxRendererProcessCount); | 74 ASSERT_NE(0u, kMaxRendererProcessCount); | 
| 79 std::vector<std::unique_ptr<MockRenderProcessHost>> hosts; | 75 std::vector<std::unique_ptr<MockRenderProcessHost>> hosts; | 
| 80 for (size_t i = 0; i < kMaxRendererProcessCount; ++i) { | 76 for (size_t i = 0; i < kMaxRendererProcessCount; ++i) { | 
| 81 hosts.push_back(base::MakeUnique<MockRenderProcessHost>(browser_context())); | 77 hosts.push_back(base::MakeUnique<MockRenderProcessHost>(browser_context())); | 
| 82 } | 78 } | 
| 83 | 79 | 
| 84 // Verify that the renderer sharing still won't happen. | 80 // Verify that the renderer sharing still won't happen. | 
| 85 GURL test_url("http://foo.com"); | 81 GURL test_url("http://foo.com"); | 
| 86 EXPECT_FALSE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost( | 82 EXPECT_FALSE(RenderProcessHostImpl::ShouldTryToUseExistingProcessHost( | 
| 87 browser_context(), test_url)); | 83 browser_context(), test_url)); | 
| 88 } | 84 } | 
| 89 #endif | 85 #endif | 
| 90 | 86 | 
| 91 } // namespace content | 87 } // namespace content | 
| OLD | NEW |