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

Side by Side Diff: base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc

Issue 2101263003: base: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/pending_task.h" 10 #include "base/pending_task.h"
(...skipping 16 matching lines...) Expand all
27 const char kGingerbread[] = "Gingerbread"; 27 const char kGingerbread[] = "Gingerbread";
28 28
29 // Asserts that the fixed-size array |expected_backtrace| matches the backtrace 29 // Asserts that the fixed-size array |expected_backtrace| matches the backtrace
30 // in |AllocationContextTracker::GetContextSnapshot|. 30 // in |AllocationContextTracker::GetContextSnapshot|.
31 template <size_t N> 31 template <size_t N>
32 void AssertBacktraceEquals(const StackFrame(&expected_backtrace)[N]) { 32 void AssertBacktraceEquals(const StackFrame(&expected_backtrace)[N]) {
33 AllocationContext ctx = 33 AllocationContext ctx =
34 AllocationContextTracker::GetInstanceForCurrentThread() 34 AllocationContextTracker::GetInstanceForCurrentThread()
35 ->GetContextSnapshot(); 35 ->GetContextSnapshot();
36 36
37 auto actual = std::begin(ctx.backtrace.frames); 37 auto* actual = std::begin(ctx.backtrace.frames);
38 auto actual_bottom = actual + ctx.backtrace.frame_count; 38 auto* actual_bottom = actual + ctx.backtrace.frame_count;
39 auto expected = std::begin(expected_backtrace); 39 auto expected = std::begin(expected_backtrace);
40 auto expected_bottom = std::end(expected_backtrace); 40 auto expected_bottom = std::end(expected_backtrace);
41 41
42 // Note that this requires the pointers to be equal, this is not doing a deep 42 // Note that this requires the pointers to be equal, this is not doing a deep
43 // string comparison. 43 // string comparison.
44 for (; actual != actual_bottom && expected != expected_bottom; 44 for (; actual != actual_bottom && expected != expected_bottom;
45 actual++, expected++) 45 actual++, expected++)
46 ASSERT_EQ(*expected, *actual); 46 ASSERT_EQ(*expected, *actual);
47 47
48 // Ensure that the height of the stacks is the same. 48 // Ensure that the height of the stacks is the same.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 AllocationContextTracker::GetInstanceForCurrentThread() 276 AllocationContextTracker::GetInstanceForCurrentThread()
277 ->GetContextSnapshot(); 277 ->GetContextSnapshot();
278 const StringPiece kTracingOverhead("tracing_overhead"); 278 const StringPiece kTracingOverhead("tracing_overhead");
279 ASSERT_EQ(kTracingOverhead, 279 ASSERT_EQ(kTracingOverhead,
280 static_cast<const char*>(ctx.backtrace.frames[0].value)); 280 static_cast<const char*>(ctx.backtrace.frames[0].value));
281 ASSERT_EQ(1u, ctx.backtrace.frame_count); 281 ASSERT_EQ(1u, ctx.backtrace.frame_count);
282 } 282 }
283 283
284 } // namespace trace_event 284 } // namespace trace_event
285 } // namespace base 285 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker.cc ('k') | base/trace_event/malloc_dump_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698