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

Unified Diff: src/snapshot/serializer-common.h

Issue 2781993005: Protect SerializedData from copying. (Closed)
Patch Set: Use DISALLOW_COPY_AND_ASSIGN macro. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/code-serializer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serializer-common.h
diff --git a/src/snapshot/serializer-common.h b/src/snapshot/serializer-common.h
index 02f97628b5a080b9e7683744b20b24b421127afe..550fd3833944cc1c2825ba20000ff0f80572307a 100644
--- a/src/snapshot/serializer-common.h
+++ b/src/snapshot/serializer-common.h
@@ -239,6 +239,11 @@ class SerializedData {
SerializedData(byte* data, int size)
: data_(data), size_(size), owns_data_(false) {}
SerializedData() : data_(NULL), size_(0), owns_data_(false) {}
+ SerializedData(SerializedData&& other)
+ : data_(other.data_), size_(other.size_), owns_data_(other.owns_data_) {
+ // Ensure |other| will not attempt to destroy our data in destructor.
+ other.owns_data_ = false;
+ }
~SerializedData() {
if (owns_data_) DeleteArray<byte>(data_);
@@ -295,6 +300,9 @@ class SerializedData {
byte* data_;
int size_;
bool owns_data_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SerializedData);
};
} // namespace internal
« no previous file with comments | « src/snapshot/code-serializer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698