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

Unified Diff: base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc

Issue 1471683002: [StyleGuide] Allow begin and end non-member functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add link to discussion thread Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker.cc ('k') | styleguide/c++/c++11.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
diff --git a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
index fe3f40736f3a5fafa0e7cced8aa12ef7b50d1aee..130a9279534a14aaeaca7cbffda33b8952ce8104 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
+++ b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <iterator>
+
#include "base/memory/ref_counted.h"
#include "base/trace_event/heap_profiler_allocation_context.h"
#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
@@ -19,23 +21,16 @@ const char kEclair[] = "Eclair";
const char kFroyo[] = "Froyo";
const char kGingerbread[] = "Gingerbread";
-// Returns a pointer past the end of the fixed-size array |array| of |T| of
-// length |N|, identical to C++11 |std::end|.
-template <typename T, int N>
-const T* End(const T(&array)[N]) {
- return array + N;
-}
-
// Asserts that the fixed-size array |expected_backtrace| matches the backtrace
// in |AllocationContextTracker::GetContextSnapshot|.
template <size_t N>
void AssertBacktraceEquals(const StackFrame(&expected_backtrace)[N]) {
AllocationContext ctx = AllocationContextTracker::GetContextSnapshot();
- auto actual = ctx.backtrace.frames;
- auto actual_bottom = End(ctx.backtrace.frames);
- auto expected = expected_backtrace;
- auto expected_bottom = End(expected_backtrace);
+ auto actual = std::begin(ctx.backtrace.frames);
+ auto actual_bottom = std::end(ctx.backtrace.frames);
+ auto expected = std::begin(expected_backtrace);
+ auto expected_bottom = std::end(expected_backtrace);
// Note that this requires the pointers to be equal, this is not doing a deep
// string comparison.
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker.cc ('k') | styleguide/c++/c++11.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698