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

Side by Side Diff: base/memory/weak_ptr.cc

Issue 2094873003: Make base::WeakPtr moveable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: std::move WeakPtrBase Created 4 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 | « base/memory/weak_ptr.h ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/weak_ptr.h" 5 #include "base/memory/weak_ptr.h"
6 6
7 namespace base { 7 namespace base {
8 namespace internal { 8 namespace internal {
9 9
10 WeakReference::Flag::Flag() : is_valid_(true) { 10 WeakReference::Flag::Flag() : is_valid_(true) {
(...skipping 16 matching lines...) Expand all
27 << "WeakPtrs must be checked on the same sequenced thread."; 27 << "WeakPtrs must be checked on the same sequenced thread.";
28 return is_valid_; 28 return is_valid_;
29 } 29 }
30 30
31 WeakReference::Flag::~Flag() { 31 WeakReference::Flag::~Flag() {
32 } 32 }
33 33
34 WeakReference::WeakReference() { 34 WeakReference::WeakReference() {
35 } 35 }
36 36
37 WeakReference::WeakReference(const WeakReference& other) = default;
38
39 WeakReference::WeakReference(const Flag* flag) : flag_(flag) { 37 WeakReference::WeakReference(const Flag* flag) : flag_(flag) {
40 } 38 }
41 39
42 WeakReference::~WeakReference() { 40 WeakReference::~WeakReference() {
43 } 41 }
44 42
43 WeakReference::WeakReference(WeakReference&& other) = default;
44
45 WeakReference::WeakReference(const WeakReference& other) = default;
46
45 bool WeakReference::is_valid() const { return flag_.get() && flag_->IsValid(); } 47 bool WeakReference::is_valid() const { return flag_.get() && flag_->IsValid(); }
46 48
47 WeakReferenceOwner::WeakReferenceOwner() { 49 WeakReferenceOwner::WeakReferenceOwner() {
48 } 50 }
49 51
50 WeakReferenceOwner::~WeakReferenceOwner() { 52 WeakReferenceOwner::~WeakReferenceOwner() {
51 Invalidate(); 53 Invalidate();
52 } 54 }
53 55
54 WeakReference WeakReferenceOwner::GetRef() const { 56 WeakReference WeakReferenceOwner::GetRef() const {
(...skipping 15 matching lines...) Expand all
70 } 72 }
71 73
72 WeakPtrBase::~WeakPtrBase() { 74 WeakPtrBase::~WeakPtrBase() {
73 } 75 }
74 76
75 WeakPtrBase::WeakPtrBase(const WeakReference& ref) : ref_(ref) { 77 WeakPtrBase::WeakPtrBase(const WeakReference& ref) : ref_(ref) {
76 } 78 }
77 79
78 } // namespace internal 80 } // namespace internal
79 } // namespace base 81 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/weak_ptr.h ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698