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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "content/child/child_discardable_shared_memory_manager.h" | 7 #include "content/child/child_discardable_shared_memory_manager.h" |
8 #include "content/child/child_thread_impl.h" | 8 #include "content/child/child_thread_impl.h" |
9 #include "content/common/host_discardable_shared_memory_manager.h" | 9 #include "content/common/host_discardable_shared_memory_manager.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "content/public/test/content_browser_test.h" | 11 #include "content/public/test/content_browser_test.h" |
12 #include "content/public/test/content_browser_test_utils.h" | 12 #include "content/public/test/content_browser_test_utils.h" |
13 #include "content/shell/browser/shell.h" | 13 #include "content/shell/browser/shell.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // ChromeOS does not do software compositing, so kDisableGpu is not available | |
19 // there. | |
20 #if !defined(OS_CHROMEOS) | |
21 | |
22 class ChildDiscardableSharedMemoryManagerBrowserTest | 18 class ChildDiscardableSharedMemoryManagerBrowserTest |
23 : public ContentBrowserTest { | 19 : public ContentBrowserTest { |
24 public: | 20 public: |
25 void SetUpCommandLine(base::CommandLine* command_line) override { | 21 void SetUpCommandLine(base::CommandLine* command_line) override { |
26 command_line->AppendSwitch(switches::kSingleProcess); | 22 command_line->AppendSwitch(switches::kSingleProcess); |
27 command_line->AppendSwitch(switches::kDisableGpu); | |
28 } | 23 } |
29 | 24 |
30 static void ReleaseFreeMemory() { | 25 static void ReleaseFreeMemory() { |
31 ChildThreadImpl::current() | 26 ChildThreadImpl::current() |
32 ->discardable_shared_memory_manager() | 27 ->discardable_shared_memory_manager() |
33 ->ReleaseFreeMemory(); | 28 ->ReleaseFreeMemory(); |
34 } | 29 } |
35 | 30 |
36 static void AllocateLockedMemory( | 31 static void AllocateLockedMemory( |
37 size_t size, | 32 size_t size, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 memory.get())); | 110 memory.get())); |
116 } | 111 } |
117 | 112 |
118 for (auto& memory : instances) { | 113 for (auto& memory : instances) { |
119 PostTaskToInProcessRendererAndWait( | 114 PostTaskToInProcessRendererAndWait( |
120 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::FreeMemory, | 115 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::FreeMemory, |
121 base::Passed(&memory))); | 116 base::Passed(&memory))); |
122 } | 117 } |
123 } | 118 } |
124 | 119 |
125 #endif // !OS_CHROMEOS | |
126 | |
127 } // content | 120 } // content |
OLD | NEW |