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

Unified Diff: chrome/browser/themes/browser_theme_pack.cc

Issue 10854003: Fix Mac ASAN build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/themes/browser_theme_pack.cc
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index 41c69fcc3ca225b9e8e6516295f4a84dedcef097..fef23f27ec18bea770f6eeb19355a40bb3f70292 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -203,15 +203,15 @@ bool InputScalesValid(const char* input,
}
// Returns |scale_factors| as a string to be written to disk.
-base::StringPiece GetScaleFactorsAsString(
+std::string GetScaleFactorsAsString(
const std::vector<ui::ScaleFactor>& scale_factors) {
size_t scales_size = scale_factors.size() + 1;
float* scales = new float[scales_size];
for (size_t i = 0; i < scale_factors.size(); ++i)
scales[i] = ui::GetScaleFactorScale(scale_factors[i]);
scales[scales_size - 1] = -1.0f;
- base::StringPiece out_string = base::StringPiece(
- reinterpret_cast<const char*>(&scales),
+ std::string out_string = std::string(
+ reinterpret_cast<const char*>(scales),
scales_size * sizeof(float));
delete[] scales;
return out_string;
@@ -540,7 +540,10 @@ bool BrowserThemePack::WriteToDisk(const FilePath& path) const {
reinterpret_cast<const char*>(source_images_),
source_count * sizeof(*source_images_));
- resources[kScaleFactorsID] = GetScaleFactorsAsString(scale_factors_);
+ // Store results of GetScaleFactorsAsString() in std::string as
+ // base::StringPiece does not copy data in constructor.
+ std::string scale_factors_string = GetScaleFactorsAsString(scale_factors_);
+ resources[kScaleFactorsID] = scale_factors_string;
AddRawImagesTo(image_memory_, &resources);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698