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

Unified Diff: content/browser/dom_storage/local_storage_context_mojo.cc

Issue 2767103002: Fix localstorage data migration. (Closed)
Patch Set: 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
Index: content/browser/dom_storage/local_storage_context_mojo.cc
diff --git a/content/browser/dom_storage/local_storage_context_mojo.cc b/content/browser/dom_storage/local_storage_context_mojo.cc
index 6cc0c76f6b6e2d9ff749ead7c50cbf3e5b2092b0..44a8873178cb7e70a89ab85bdfd5bd772a68ca5b 100644
--- a/content/browser/dom_storage/local_storage_context_mojo.cc
+++ b/content/browser/dom_storage/local_storage_context_mojo.cc
@@ -70,7 +70,11 @@ void NoOpSuccess(bool success) {}
std::vector<uint8_t> String16ToUint8Vector(const base::string16& input) {
const uint8_t* data = reinterpret_cast<const uint8_t*>(input.data());
- return std::vector<uint8_t>(data, data + input.size() * sizeof(base::char16));
+ std::vector<uint8_t> result;
+ result.reserve(input.size() * sizeof(base::char16) + 1);
+ result.push_back(0);
michaeln 2017/03/22 23:49:51 The magic "0" value here is pretty magical, it mig
Marijn Kruisselbrink 2017/03/31 23:06:14 Yeah, I agree that this isn't very nice. I changed
+ result.insert(result.end(), data, data + input.size() * sizeof(base::char16));
+ return result;
}
void MigrateStorageHelper(

Powered by Google App Engine
This is Rietveld 408576698