Skip to content

Commit 3fefe0e

Browse files
author
Alex Ames
authored
Merge pull request #400 from firebase/feature/mutable-data-copy-deprecation
Removed deprecated copy constructor from MutableData
2 parents 7d6d8c9 + 001dccd commit 3fefe0e

File tree

8 files changed

+4
-51
lines changed

8 files changed

+4
-51
lines changed

database/src/android/mutable_data_android.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ MutableDataInternal::~MutableDataInternal() {
6161
}
6262
}
6363

64-
MutableDataInternal* MutableDataInternal::Clone() {
65-
return new MutableDataInternal(db_, obj_);
66-
}
67-
6864
bool MutableDataInternal::Initialize(App* app) {
6965
JNIEnv* env = app->GetJNIEnv();
7066
jobject activity = app->activity();

database/src/android/mutable_data_android.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ class MutableDataInternal {
3939
public:
4040
~MutableDataInternal();
4141

42-
// Create a shallow copy of the MutableData.
43-
// The caller owns the returned pointer and is responsible for deleting it.
44-
MutableDataInternal* Clone();
45-
4642
// Used to obtain a MutableData instance that encapsulates the data and
4743
// priority at the given relative path.
4844
MutableDataInternal* Child(const char* path);

database/src/common/mutable_data.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,6 @@ MutableData::MutableData(MutableDataInternal* internal) : internal_(internal) {
5252
CleanupFnMutableData::Register(this, internal_);
5353
}
5454

55-
MutableData::MutableData(const MutableData& rhs)
56-
: internal_(rhs.internal_ ? rhs.internal_->Clone() : nullptr) {
57-
CleanupFnMutableData::Register(this, internal_);
58-
}
59-
60-
MutableData& MutableData::operator=(const MutableData& rhs) {
61-
CleanupFnMutableData::Unregister(this, internal_);
62-
if (internal_) delete internal_;
63-
internal_ = rhs.internal_ ? rhs.internal_->Clone() : nullptr;
64-
CleanupFnMutableData::Register(this, internal_);
65-
return *this;
66-
}
67-
6855
#if defined(FIREBASE_USE_MOVE_OPERATORS)
6956
MutableData::MutableData(MutableData&& rhs) : internal_(rhs.internal_) {
7057
rhs.internal_ = nullptr;

database/src/desktop/mutable_data_desktop.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ MutableDataInternal::MutableDataInternal(const MutableDataInternal& other,
4343
const Path& path)
4444
: db_(other.db_), path_(path), holder_(other.holder_) {}
4545

46-
MutableDataInternal* MutableDataInternal::Clone() {
47-
// Just use the copy constructor
48-
return new MutableDataInternal(*this);
49-
}
50-
5146
MutableDataInternal* MutableDataInternal::Child(const char* path) {
5247
return new MutableDataInternal(*this, path_.GetChild(path));
5348
}

database/src/desktop/mutable_data_desktop.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ class MutableDataInternal {
3333
// This constructor is used when creating the original copy of MutableData
3434
explicit MutableDataInternal(DatabaseInternal* database, const Variant& data);
3535

36-
// Create a shallow copy of the MutableData.
37-
// The caller owns the returned pointer and is responsible for deleting it.
38-
MutableDataInternal* Clone();
39-
4036
// Used to obtain a MutableData instance that encapsulates the data and
4137
// priority at the given relative path.
4238
MutableDataInternal* Child(const char* path);
@@ -90,6 +86,7 @@ class MutableDataInternal {
9086
const Path& path);
9187

9288
DatabaseInternal* db_;
89+
9390
// Path relative to the root of holder_
9491
Path path_;
9592

database/src/include/firebase/database/mutable_data.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,6 @@ class Repo;
3434
#endif // SWIG
3535
class MutableData {
3636
public:
37-
/// @brief Copy constructor.
38-
///
39-
/// This only makes a shallow copy and copies of MutableData will share the
40-
/// same internal data. I.e. changes to one copy will appear in the other.
41-
/// The main reason the copy constructor is provided is to allow the Child
42-
/// method to return a MutableData by value.
43-
MutableData(const MutableData& rhs);
44-
45-
/// @brief Copy assignment operator
46-
///
47-
/// @deprecated MutableData is not supposed to be assigned.
48-
FIREBASE_DEPRECATED MutableData& operator=(const MutableData& rhs);
49-
5037
#if defined(FIREBASE_USE_MOVE_OPERATORS)
5138
/// Move constructor
5239
/// Move is more efficient than copy and delete.
@@ -166,6 +153,9 @@ class MutableData {
166153

167154
explicit MutableData(internal::MutableDataInternal* internal);
168155

156+
MutableData(const MutableData& rhs) = delete;
157+
MutableData& operator=(const MutableData& rhs) = delete;
158+
169159
internal::MutableDataInternal* internal_;
170160
};
171161

database/src/ios/mutable_data_ios.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ class MutableDataInternal {
4343
public:
4444
~MutableDataInternal();
4545

46-
// Create a shallow copy of the MutableData.
47-
// The caller owns the returned pointer and is responsible for deleting it.
48-
MutableDataInternal* Clone();
49-
5046
// Used to obtain a MutableData instance that encapsulates the data and
5147
// priority at the given relative path.
5248
MutableDataInternal* Child(const char* path);

database/src/ios/mutable_data_ios.mm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535

3636
MutableDataInternal::~MutableDataInternal() {}
3737

38-
MutableDataInternal* MutableDataInternal::Clone() {
39-
return new MutableDataInternal(db_, MakeUnique<FIRMutableDataPointer>(impl()));
40-
}
41-
4238
MutableDataInternal* MutableDataInternal::Child(const char* path) {
4339
return new MutableDataInternal(
4440
db_, MakeUnique<FIRMutableDataPointer>([impl() childDataByAppendingPath:@(path)]));

0 commit comments

Comments
 (0)