| 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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 static void UnlockMemory(base::DiscardableMemoryShmemChunk* memory) { | 45 static void UnlockMemory(base::DiscardableMemoryShmemChunk* memory) { |
| 46 memory->Unlock(); | 46 memory->Unlock(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 static void FreeMemory(scoped_ptr<base::DiscardableMemoryShmemChunk> memory) { | 49 static void FreeMemory(scoped_ptr<base::DiscardableMemoryShmemChunk> memory) { |
| 50 } | 50 } |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 #if defined(OS_WIN) |
| 54 #define MAYBE_LockMemory DISABLED_LockMemory |
| 55 #else |
| 56 #define MAYBE_LockMemory LockMemory |
| 57 #endif |
| 58 |
| 53 IN_PROC_BROWSER_TEST_F(ChildDiscardableSharedMemoryManagerBrowserTest, | 59 IN_PROC_BROWSER_TEST_F(ChildDiscardableSharedMemoryManagerBrowserTest, |
| 54 LockMemory) { | 60 MAYBE_LockMemory) { |
| 55 const size_t kSize = 1024 * 1024; // 1MiB. | 61 const size_t kSize = 1024 * 1024; // 1MiB. |
| 56 | 62 |
| 57 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); | 63 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
| 58 | 64 |
| 59 scoped_ptr<base::DiscardableMemoryShmemChunk> memory; | 65 scoped_ptr<base::DiscardableMemoryShmemChunk> memory; |
| 60 PostTaskToInProcessRendererAndWait(base::Bind( | 66 PostTaskToInProcessRendererAndWait(base::Bind( |
| 61 &ChildDiscardableSharedMemoryManagerBrowserTest::AllocateLockedMemory, | 67 &ChildDiscardableSharedMemoryManagerBrowserTest::AllocateLockedMemory, |
| 62 kSize, &memory)); | 68 kSize, &memory)); |
| 63 | 69 |
| 64 ASSERT_TRUE(memory); | 70 ASSERT_TRUE(memory); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 112 } |
| 107 | 113 |
| 108 for (auto& memory : instances) { | 114 for (auto& memory : instances) { |
| 109 PostTaskToInProcessRendererAndWait( | 115 PostTaskToInProcessRendererAndWait( |
| 110 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::FreeMemory, | 116 base::Bind(&ChildDiscardableSharedMemoryManagerBrowserTest::FreeMemory, |
| 111 base::Passed(&memory))); | 117 base::Passed(&memory))); |
| 112 } | 118 } |
| 113 } | 119 } |
| 114 | 120 |
| 115 } // content | 121 } // content |
| OLD | NEW |