summaryrefslogtreecommitdiff
path: root/chromium/components/services/heap_profiling/allocation.cc
blob: 7c49ef1f1f4f5fdb643f762e9c43aa26610e8fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/services/heap_profiling/allocation.h"

#include "base/hash/hash.h"

namespace heap_profiling {

namespace {
uint32_t ComputeHash(const std::vector<Address>& addrs) {
  return base::Hash(addrs.data(), addrs.size() * sizeof(Address));
}
}  // namespace

AllocationSite::AllocationSite(AllocatorType allocator,
                               std::vector<Address>&& stack,
                               int context_id)
    : allocator(allocator),
      stack(std::move(stack)),
      context_id(context_id),
      hash_(ComputeHash(this->stack)) {}

AllocationSite::~AllocationSite() = default;

}  // namespace heap_profiling