/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 | 34.1M | bool CallbackBase::is_null() const { |
28 | 34.1M | return bind_state_.get() == nullptr; |
29 | 34.1M | } |
30 | | |
31 | 9.96M | void CallbackBase::Reset() { |
32 | 9.96M | 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 | 9.96M | bind_state_ = nullptr; |
36 | 9.96M | } |
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 | 112M | polymorphic_invoke_(nullptr) { |
46 | 112M | DCHECK(!bind_state_.get() || bind_state_->HasOneRef()); |
47 | 112M | } |
48 | | |
49 | 307M | CallbackBase::~CallbackBase() { |
50 | 307M | } |
51 | | |
52 | | } // namespace internal |
53 | | } // namespace yb |