OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/child/child_thread_impl.h" |
| 6 |
5 #include <stddef.h> | 7 #include <stddef.h> |
6 #include <string.h> | 8 #include <string.h> |
| 9 #include <utility> |
7 | 10 |
8 #include "base/bind.h" | 11 #include "base/bind.h" |
9 #include "base/command_line.h" | 12 #include "base/command_line.h" |
10 #include "base/memory/discardable_memory.h" | 13 #include "base/memory/discardable_memory.h" |
11 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
12 #include "base/time/time.h" | 15 #include "base/time/time.h" |
13 #include "content/child/child_discardable_shared_memory_manager.h" | 16 #include "content/child/child_discardable_shared_memory_manager.h" |
14 #include "content/child/child_gpu_memory_buffer_manager.h" | 17 #include "content/child/child_gpu_memory_buffer_manager.h" |
15 #include "content/child/child_thread_impl.h" | |
16 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 18 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
17 #include "content/common/host_discardable_shared_memory_manager.h" | 19 #include "content/common/host_discardable_shared_memory_manager.h" |
18 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
19 #include "content/public/test/content_browser_test.h" | 21 #include "content/public/test/content_browser_test.h" |
20 #include "content/public/test/content_browser_test_utils.h" | 22 #include "content/public/test/content_browser_test_utils.h" |
21 #include "content/shell/browser/shell.h" | 23 #include "content/shell/browser/shell.h" |
22 #include "ui/gfx/buffer_format_util.h" | 24 #include "ui/gfx/buffer_format_util.h" |
23 #include "url/gurl.h" | 25 #include "url/gurl.h" |
24 | 26 |
25 namespace content { | 27 namespace content { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 92 |
91 ScopedVector<base::DiscardableMemory> instances; | 93 ScopedVector<base::DiscardableMemory> instances; |
92 for (size_t i = 0; i < kNumberOfInstances; ++i) { | 94 for (size_t i = 0; i < kNumberOfInstances; ++i) { |
93 scoped_ptr<base::DiscardableMemory> memory = | 95 scoped_ptr<base::DiscardableMemory> memory = |
94 child_discardable_shared_memory_manager() | 96 child_discardable_shared_memory_manager() |
95 ->AllocateLockedDiscardableMemory(kLargeSize); | 97 ->AllocateLockedDiscardableMemory(kLargeSize); |
96 ASSERT_TRUE(memory); | 98 ASSERT_TRUE(memory); |
97 void* addr = memory->data(); | 99 void* addr = memory->data(); |
98 ASSERT_NE(nullptr, addr); | 100 ASSERT_NE(nullptr, addr); |
99 memory->Unlock(); | 101 memory->Unlock(); |
100 instances.push_back(memory.Pass()); | 102 instances.push_back(std::move(memory)); |
101 } | 103 } |
102 } | 104 } |
103 | 105 |
104 IN_PROC_BROWSER_TEST_F(ChildThreadImplBrowserTest, | 106 IN_PROC_BROWSER_TEST_F(ChildThreadImplBrowserTest, |
105 DISABLED_ReleaseFreeDiscardableMemory) { | 107 DISABLED_ReleaseFreeDiscardableMemory) { |
106 const size_t kSize = 1024 * 1024; // 1MiB. | 108 const size_t kSize = 1024 * 1024; // 1MiB. |
107 | 109 |
108 scoped_ptr<base::DiscardableMemory> memory = | 110 scoped_ptr<base::DiscardableMemory> memory = |
109 child_discardable_shared_memory_manager() | 111 child_discardable_shared_memory_manager() |
110 ->AllocateLockedDiscardableMemory(kSize); | 112 ->AllocateLockedDiscardableMemory(kSize); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 kEnableNativeBuffers), | 200 kEnableNativeBuffers), |
199 // These formats are guaranteed to work on all platforms. | 201 // These formats are guaranteed to work on all platforms. |
200 ::testing::Values(gfx::BufferFormat::R_8, | 202 ::testing::Values(gfx::BufferFormat::R_8, |
201 gfx::BufferFormat::RGBA_4444, | 203 gfx::BufferFormat::RGBA_4444, |
202 gfx::BufferFormat::RGBA_8888, | 204 gfx::BufferFormat::RGBA_8888, |
203 gfx::BufferFormat::BGRA_8888, | 205 gfx::BufferFormat::BGRA_8888, |
204 gfx::BufferFormat::YUV_420))); | 206 gfx::BufferFormat::YUV_420))); |
205 | 207 |
206 } // namespace | 208 } // namespace |
207 } // namespace content | 209 } // namespace content |
OLD | NEW |