YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/gutil/callback_internal.cc
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2012 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
// The following only applies to changes made to this file as part of YugaByte development.
6
//
7
// Portions Copyright (c) YugaByte, Inc.
8
//
9
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
10
// in compliance with the License.  You may obtain a copy of the License at
11
//
12
// http://www.apache.org/licenses/LICENSE-2.0
13
//
14
// Unless required by applicable law or agreed to in writing, software distributed under the License
15
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
16
// or implied.  See the License for the specific language governing permissions and limitations
17
// under the License.
18
//
19
20
#include "yb/gutil/callback_internal.h"
21
22
#include <glog/logging.h>
23
24
namespace yb {
25
namespace internal {
26
27
18.6M
bool CallbackBase::is_null() const {
28
18.6M
  return bind_state_.get() == nullptr;
29
18.6M
}
30
31
5.14M
void CallbackBase::Reset() {
32
5.14M
  polymorphic_invoke_ = nullptr;
33
  // NULL the bind_state_ last, since it may be holding the last ref to whatever
34
  // object owns us, and we may be deleted after that.
35
5.14M
  bind_state_ = nullptr;
36
5.14M
}
37
38
0
bool CallbackBase::Equals(const CallbackBase& other) const {
39
0
  return bind_state_.get() == other.bind_state_.get() &&
40
0
         polymorphic_invoke_ == other.polymorphic_invoke_;
41
0
}
42
43
CallbackBase::CallbackBase(BindStateBase* bind_state)
44
    : bind_state_(bind_state),
45
58.6M
      polymorphic_invoke_(nullptr) {
46
58.6M
  DCHECK(!bind_state_.get() || bind_state_->HasOneRef());
47
58.6M
}
48
49
152M
CallbackBase::~CallbackBase() {
50
152M
}
51
52
}  // namespace internal
53
}  // namespace yb