diff options
Diffstat (limited to 'absl/strings/internal/cordz_info.cc')
-rw-r--r-- | absl/strings/internal/cordz_info.cc | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/absl/strings/internal/cordz_info.cc b/absl/strings/internal/cordz_info.cc index 6540d134..d2200680 100644 --- a/absl/strings/internal/cordz_info.cc +++ b/absl/strings/internal/cordz_info.cc @@ -45,15 +45,22 @@ CordzInfo* CordzInfo::Next(const CordzSnapshot& snapshot) const { return ci_next_unsafe(); } -CordzInfo* CordzInfo::TrackCord(CordRep* rep, const CordzInfo* src, - MethodIdentifier method) { - CordzInfo* ci = new CordzInfo(rep, src, method); - ci->Track(); - return ci; +void CordzInfo::TrackCord(InlineData& cord, MethodIdentifier method) { + assert(cord.is_tree()); + assert(!cord.is_profiled()); + CordzInfo* cordz_info = new CordzInfo(cord.as_tree(), nullptr, method); + cord.set_cordz_info(cordz_info); + cordz_info->Track(); } -CordzInfo* CordzInfo::TrackCord(CordRep* rep, MethodIdentifier method) { - return TrackCord(rep, nullptr, method); +void CordzInfo::TrackCord(InlineData& cord, const InlineData& src, + MethodIdentifier method) { + assert(cord.is_tree()); + assert(!cord.is_profiled()); + auto* info = src.is_tree() && src.is_profiled() ? src.cordz_info() : nullptr; + CordzInfo* cordz_info = new CordzInfo(cord.as_tree(), info, method); + cord.set_cordz_info(cordz_info); + cordz_info->Track(); } void CordzInfo::UntrackCord(CordzInfo* cordz_info) { @@ -160,14 +167,6 @@ void CordzInfo::Unlock() ABSL_UNLOCK_FUNCTION(mutex_) { } } -void CordzInfo::SetCordRep(CordRep* rep) { - mutex_.AssertHeld(); - rep_ = rep; - if (rep) { - size_.store(rep->length); - } -} - absl::Span<void* const> CordzInfo::GetStack() const { return absl::MakeConstSpan(stack_, stack_depth_); } |