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

Side by Side Diff: chrome/profiling/backtrace.cc

Issue 2943733002: Add out-of-process memory logging stream parsing. (Closed)
Patch Set: Review comments Created 3 years, 6 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 | « chrome/profiling/backtrace.h ('k') | chrome/profiling/backtrace_storage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/profiling/backtrace.h"
6
7 #include <string.h>
8
9 #include <algorithm>
10
11 #include "base/hash.h"
12 #include "chrome/profiling/backtrace_storage.h"
13 #include "chrome/profiling/profiling_globals.h"
14
15 namespace profiling {
16
17 namespace {
18
19 size_t ComputeHash(const std::vector<Address>& addrs) {
awong 2017/06/19 23:42:05 Can you add a TODO here assigned to me to fix this
20 if (addrs.empty())
21 return 0;
22 // Assume Address is a POD containing only the address with no padding.
23 return base::Hash(reinterpret_cast<const char*>(&addrs[0]),
24 addrs.size() * sizeof(Address));
25 }
26
27 } // namespace
28
29 Backtrace::Backtrace(std::vector<Address>&& a)
30 : addrs_(std::move(a)), fingerprint_(ComputeHash(addrs_)) {}
31
32 Backtrace::Backtrace(Backtrace&& other) noexcept = default;
33
34 Backtrace::~Backtrace() {}
35
36 Backtrace& Backtrace::operator=(Backtrace&& other) = default;
37
38 bool Backtrace::operator==(const Backtrace& other) const {
39 if (addrs_.size() != other.addrs_.size())
40 return false;
41 return memcmp(addrs_.data(), other.addrs_.data(),
42 addrs_.size() * sizeof(Address)) == 0;
43 }
44
45 bool Backtrace::operator!=(const Backtrace& other) const {
46 return !operator==(other);
47 }
48
49 } // namespace profiling
OLDNEW
« no previous file with comments | « chrome/profiling/backtrace.h ('k') | chrome/profiling/backtrace_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698