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

Side by Side Diff: content/renderer/render_thread_impl_discardable_memory_browsertest.cc

Issue 2705073003: Remove ScopedVector from content/renderer/. (Closed)
Patch Set: Rebase only Created 3 years, 9 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 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 "content/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <memory>
9 #include <utility> 11 #include <utility>
12 #include <vector>
10 13
11 #include "base/bind.h" 14 #include "base/bind.h"
12 #include "base/command_line.h" 15 #include "base/command_line.h"
13 #include "base/memory/discardable_memory.h" 16 #include "base/memory/discardable_memory.h"
14 #include "base/memory/scoped_vector.h"
15 #include "base/time/time.h" 17 #include "base/time/time.h"
16 #include "build/build_config.h" 18 #include "build/build_config.h"
17 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h" 19 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h"
18 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" 20 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h"
19 #include "content/browser/browser_main_loop.h" 21 #include "content/browser/browser_main_loop.h"
20 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
21 #include "content/public/test/content_browser_test.h" 23 #include "content/public/test/content_browser_test.h"
22 #include "content/public/test/content_browser_test_utils.h" 24 #include "content/public/test/content_browser_test_utils.h"
23 #include "content/shell/browser/shell.h" 25 #include "content/shell/browser/shell.h"
24 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" 26 #include "gpu/ipc/client/gpu_memory_buffer_impl.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 86 }
85 87
86 // Disable the test for the Android asan build. 88 // Disable the test for the Android asan build.
87 // See http://crbug.com/667837 for detail. 89 // See http://crbug.com/667837 for detail.
88 #if !(defined(OS_ANDROID) && defined(ADDRESS_SANITIZER)) 90 #if !(defined(OS_ANDROID) && defined(ADDRESS_SANITIZER))
89 IN_PROC_BROWSER_TEST_F(RenderThreadImplDiscardableMemoryBrowserTest, 91 IN_PROC_BROWSER_TEST_F(RenderThreadImplDiscardableMemoryBrowserTest,
90 DiscardableMemoryAddressSpace) { 92 DiscardableMemoryAddressSpace) {
91 const size_t kLargeSize = 4 * 1024 * 1024; // 4MiB. 93 const size_t kLargeSize = 4 * 1024 * 1024; // 4MiB.
92 const size_t kNumberOfInstances = 1024 + 1; // >4GiB total. 94 const size_t kNumberOfInstances = 1024 + 1; // >4GiB total.
93 95
94 ScopedVector<base::DiscardableMemory> instances; 96 std::vector<std::unique_ptr<base::DiscardableMemory>> instances;
95 for (size_t i = 0; i < kNumberOfInstances; ++i) { 97 for (size_t i = 0; i < kNumberOfInstances; ++i) {
96 std::unique_ptr<base::DiscardableMemory> memory = 98 std::unique_ptr<base::DiscardableMemory> memory =
97 child_discardable_shared_memory_manager() 99 child_discardable_shared_memory_manager()
98 ->AllocateLockedDiscardableMemory(kLargeSize); 100 ->AllocateLockedDiscardableMemory(kLargeSize);
99 ASSERT_TRUE(memory); 101 ASSERT_TRUE(memory);
100 void* addr = memory->data(); 102 void* addr = memory->data();
101 ASSERT_NE(nullptr, addr); 103 ASSERT_NE(nullptr, addr);
102 memory->Unlock(); 104 memory->Unlock();
103 instances.push_back(std::move(memory)); 105 instances.push_back(std::move(memory));
104 } 106 }
(...skipping 26 matching lines...) Expand all
131 ->discardable_shared_memory_manager() 133 ->discardable_shared_memory_manager()
132 ->GetBytesAllocated()) 134 ->GetBytesAllocated())
133 break; 135 break;
134 } 136 }
135 137
136 EXPECT_LT(base::TimeTicks::Now(), end); 138 EXPECT_LT(base::TimeTicks::Now(), end);
137 } 139 }
138 140
139 } // namespace 141 } // namespace
140 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/scheduler/resource_dispatch_throttler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698