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

Side by Side Diff: base/allocator/allocator_shim_unittest.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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
« no previous file with comments | « no previous file | base/android/application_status_listener_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/allocator/allocator_shim.h" 5 #include "base/allocator/allocator_shim.h"
6 6
7 #include <malloc.h> 7 #include <malloc.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <unistd.h> 10 #include <unistd.h>
11 11
12 #include <memory>
12 #include <new> 13 #include <new>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/atomicops.h" 16 #include "base/atomicops.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "base/threading/platform_thread.h" 18 #include "base/threading/platform_thread.h"
19 #include "base/threading/thread_local.h" 19 #include "base/threading/thread_local.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 namespace base { 23 namespace base {
24 namespace allocator { 24 namespace allocator {
25 namespace { 25 namespace {
26 26
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void TearDown() override { instance_ = nullptr; } 119 void TearDown() override { instance_ = nullptr; }
120 120
121 protected: 121 protected:
122 size_t allocs_intercepted_by_size[kMaxSizeTracked]; 122 size_t allocs_intercepted_by_size[kMaxSizeTracked];
123 size_t zero_allocs_intercepted_by_size[kMaxSizeTracked]; 123 size_t zero_allocs_intercepted_by_size[kMaxSizeTracked];
124 size_t aligned_allocs_intercepted_by_size[kMaxSizeTracked]; 124 size_t aligned_allocs_intercepted_by_size[kMaxSizeTracked];
125 size_t aligned_allocs_intercepted_by_alignment[kMaxSizeTracked]; 125 size_t aligned_allocs_intercepted_by_alignment[kMaxSizeTracked];
126 size_t reallocs_intercepted_by_size[kMaxSizeTracked]; 126 size_t reallocs_intercepted_by_size[kMaxSizeTracked];
127 size_t reallocs_intercepted_by_addr[kMaxSizeTracked]; 127 size_t reallocs_intercepted_by_addr[kMaxSizeTracked];
128 size_t frees_intercepted_by_addr[kMaxSizeTracked]; 128 size_t frees_intercepted_by_addr[kMaxSizeTracked];
129 scoped_ptr<ThreadLocalBoolean> did_fail_realloc_0x42_once; 129 std::unique_ptr<ThreadLocalBoolean> did_fail_realloc_0x42_once;
130 subtle::Atomic32 num_new_handler_calls; 130 subtle::Atomic32 num_new_handler_calls;
131 131
132 private: 132 private:
133 static AllocatorShimTest* instance_; 133 static AllocatorShimTest* instance_;
134 }; 134 };
135 135
136 struct TestStruct1 { 136 struct TestStruct1 {
137 uint32_t ignored; 137 uint32_t ignored;
138 uint8_t ignored_2; 138 uint8_t ignored_2;
139 }; 139 };
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 event.Signal(); 305 event.Signal();
306 for (int i = 0; i < kNumThreads; ++i) 306 for (int i = 0; i < kNumThreads; ++i)
307 PlatformThread::Join(threads[i]); 307 PlatformThread::Join(threads[i]);
308 RemoveAllocatorDispatchForTesting(&g_mock_dispatch); 308 RemoveAllocatorDispatchForTesting(&g_mock_dispatch);
309 ASSERT_EQ(kNumThreads, GetNumberOfNewHandlerCalls()); 309 ASSERT_EQ(kNumThreads, GetNumberOfNewHandlerCalls());
310 } 310 }
311 311
312 } // namespace 312 } // namespace
313 } // namespace allocator 313 } // namespace allocator
314 } // namespace base 314 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/android/application_status_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698