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

Side by Side Diff: content/child/child_discardable_shared_memory_manager_browsertest.cc

Issue 1009203004: content: Add DeletedDiscardableSharedMemory IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 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"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 memory.get())); 104 memory.get()));
105 } 105 }
106 106
107 for (auto& memory : instances) { 107 for (auto& memory : instances) {
108 PostTaskToInProcessRendererAndWait( 108 PostTaskToInProcessRendererAndWait(
109 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::FreeMemory, 109 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::FreeMemory,
110 base::Passed(&memory))); 110 base::Passed(&memory)));
111 } 111 }
112 } 112 }
113 113
114 IN_PROC_BROWSER_TEST_F(ChildDiscardableSharedMemoryManagerBrowserTest,
115 DISABLED_ReleaseFreeMemory) {
116 const size_t kSize = 1024 * 1024; // 1MiB.
117
118 NavigateToURL(shell(), GURL(url::kAboutBlankURL));
119
120 scoped_ptr<base::DiscardableMemoryShmemChunk> memory;
121 PostTaskToInProcessRendererAndWait(base::Bind(
122 &ChildDiscardableSharedMemoryManagerBrowserTest::AllocateLockedMemory,
123 kSize, &memory));
124 PostTaskToInProcessRendererAndWait(
125 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::UnlockMemory,
126 memory.get()));
127 PostTaskToInProcessRendererAndWait(
128 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::FreeMemory,
129 base::Passed(&memory)));
130
131 EXPECT_GE(HostDiscardableSharedMemoryManager::current()->GetBytesAllocated(),
132 kSize);
133
134 PostTaskToInProcessRendererAndWait(base::Bind(
135 &ChildDiscardableSharedMemoryManagerBrowserTest::ReleaseFreeMemory));
136
137 EXPECT_EQ(HostDiscardableSharedMemoryManager::current()->GetBytesAllocated(),
138 0u);
139 }
140
114 } // content 141 } // content
OLDNEW
« no previous file with comments | « content/child/child_discardable_shared_memory_manager.cc ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698