diff options
-rw-r--r-- | components/favicon_base/favicon_util.cc | 47 | ||||
-rw-r--r-- | components/favicon_base/select_favicon_frames.cc | 8 | ||||
-rw-r--r-- | components/nacl/loader/nacl_listener.cc | 2 | ||||
-rw-r--r-- | components/omnibox/autocomplete_input.cc | 2 | ||||
-rw-r--r-- | components/precache/core/precache_database.cc | 14 | ||||
-rw-r--r-- | components/storage_monitor/test_volume_mount_watcher_win.cc | 5 | ||||
-rw-r--r-- | components/storage_monitor/volume_mount_watcher_win.cc | 2 | ||||
-rw-r--r-- | components/translate/core/common/translate_metrics.cc | 9 |
8 files changed, 51 insertions, 38 deletions
diff --git a/components/favicon_base/favicon_util.cc b/components/favicon_base/favicon_util.cc index 54efdf4..af547f3 100644 --- a/components/favicon_base/favicon_util.cc +++ b/components/favicon_base/favicon_util.cc @@ -55,7 +55,8 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing( // create a bitmap with given pixel size. std::map<int, float> desired_pixel_sizes; for (size_t i = 0; i < favicon_scales.size(); ++i) { - int pixel_size = std::ceil(favicon_size * favicon_scales[i]); + int pixel_size = + static_cast<int>(std::ceil(favicon_size * favicon_scales[i])); desired_pixel_sizes[pixel_size] = favicon_scales[i]; } @@ -78,57 +79,58 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing( return png_reps; } -// Returns a resampled bitmap of -// |desired_size_in_pixel| x |desired_size_in_pixel| by resampling the best -// bitmap out of |input_bitmaps|. ResizeBitmapByDownsamplingIfPossible() is -// similar to SelectFaviconFrames() but it operates on bitmaps which have -// already been resampled via SelectFaviconFrames(). +// Returns a resampled bitmap of |desired_size| x |desired_size| by resampling +// the best bitmap out of |input_bitmaps|. +// ResizeBitmapByDownsamplingIfPossible() is similar to SelectFaviconFrames() +// but it operates on bitmaps which have already been resampled via +// SelectFaviconFrames(). SkBitmap ResizeBitmapByDownsamplingIfPossible( const std::vector<SkBitmap>& input_bitmaps, - int desired_size_in_pixel) { + int desired_size) { DCHECK(!input_bitmaps.empty()); - DCHECK_NE(desired_size_in_pixel, 0); + DCHECK_NE(0, desired_size); SkBitmap best_bitmap; for (size_t i = 0; i < input_bitmaps.size(); ++i) { const SkBitmap& input_bitmap = input_bitmaps[i]; - if (input_bitmap.width() == desired_size_in_pixel && - input_bitmap.height() == desired_size_in_pixel) { + if (input_bitmap.width() == desired_size && + input_bitmap.height() == desired_size) { return input_bitmap; } else if (best_bitmap.isNull()) { best_bitmap = input_bitmap; } else if (input_bitmap.width() >= best_bitmap.width() && input_bitmap.height() >= best_bitmap.height()) { - if (best_bitmap.width() < desired_size_in_pixel || - best_bitmap.height() < desired_size_in_pixel) { + if (best_bitmap.width() < desired_size || + best_bitmap.height() < desired_size) { best_bitmap = input_bitmap; } } else { - if (input_bitmap.width() >= desired_size_in_pixel && - input_bitmap.height() >= desired_size_in_pixel) { + if (input_bitmap.width() >= desired_size && + input_bitmap.height() >= desired_size) { best_bitmap = input_bitmap; } } } - if (desired_size_in_pixel % best_bitmap.width() == 0 && - desired_size_in_pixel % best_bitmap.height() == 0) { + if (desired_size % best_bitmap.width() == 0 && + desired_size % best_bitmap.height() == 0) { // Use nearest neighbour resampling if upsampling by an integer. This // makes the result look similar to the result of SelectFaviconFrames(). SkBitmap bitmap; - bitmap.allocN32Pixels(desired_size_in_pixel, desired_size_in_pixel); + bitmap.allocN32Pixels(desired_size, desired_size); if (!best_bitmap.isOpaque()) bitmap.eraseARGB(0, 0, 0, 0); SkCanvas canvas(bitmap); - SkRect dest(SkRect::MakeWH(desired_size_in_pixel, desired_size_in_pixel)); - canvas.drawBitmapRect(best_bitmap, NULL, dest); + canvas.drawBitmapRect( + best_bitmap, NULL, + SkRect::MakeFromIRect(SkIRect::MakeWH(desired_size, desired_size))); return bitmap; } return skia::ImageOperations::Resize(best_bitmap, skia::ImageOperations::RESIZE_LANCZOS3, - desired_size_in_pixel, - desired_size_in_pixel); + desired_size, + desired_size); } } // namespace @@ -214,7 +216,8 @@ gfx::Image SelectFaviconFramesFromPNGs( gfx::ImageSkia resized_image_skia; for (size_t i = 0; i < favicon_scales_to_generate.size(); ++i) { float scale = favicon_scales_to_generate[i]; - int desired_size_in_pixel = std::ceil(favicon_size * scale); + int desired_size_in_pixel = + static_cast<int>(std::ceil(favicon_size * scale)); SkBitmap bitmap = ResizeBitmapByDownsamplingIfPossible(bitmaps, desired_size_in_pixel); resized_image_skia.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale)); diff --git a/components/favicon_base/select_favicon_frames.cc b/components/favicon_base/select_favicon_frames.cc index 8df5f8c..d53225d 100644 --- a/components/favicon_base/select_favicon_frames.cc +++ b/components/favicon_base/select_favicon_frames.cc @@ -41,8 +41,9 @@ SkBitmap SampleNearestNeighbor(const SkBitmap& contents, int desired_size) { { SkCanvas canvas(bitmap); - SkRect dest(SkRect::MakeWH(desired_size, desired_size)); - canvas.drawBitmapRect(contents, NULL, dest); + canvas.drawBitmapRect( + contents, NULL, + SkRect::MakeFromIRect(SkIRect::MakeWH(desired_size, desired_size))); } return bitmap; @@ -224,7 +225,8 @@ gfx::ImageSkia CreateFaviconImageSkia( } else { for (std::vector<float>::const_iterator iter = favicon_scales.begin(); iter != favicon_scales.end(); ++iter) { - desired_sizes.push_back(ceil(desired_size_in_dip * (*iter))); + desired_sizes.push_back( + static_cast<int>(ceil(desired_size_in_dip * (*iter)))); } } diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc index ed7f05d..80e04c6 100644 --- a/components/nacl/loader/nacl_listener.cc +++ b/components/nacl/loader/nacl_listener.cc @@ -208,7 +208,7 @@ class BrowserValidationDBProxy : public NaClValidationDB { IPC::PlatformFileForTransitToPlatformFile(ipc_fd); #if defined(OS_WIN) // On Windows, valid handles are 32 bit unsigned integers so this is safe. - *fd = reinterpret_cast<uintptr_t>(handle); + *fd = reinterpret_cast<int32>(handle); #else *fd = handle; #endif diff --git a/components/omnibox/autocomplete_input.cc b/components/omnibox/autocomplete_input.cc index bbc7f87..2c6982b 100644 --- a/components/omnibox/autocomplete_input.cc +++ b/components/omnibox/autocomplete_input.cc @@ -345,7 +345,7 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse( // Trailing slashes force the input to be treated as a URL. if (parts->path.is_nonempty()) { - char c = text[parts->path.end() - 1]; + base::char16 c = text[parts->path.end() - 1]; if ((c == '\\') || (c == '/')) return metrics::OmniboxInputType::URL; } diff --git a/components/precache/core/precache_database.cc b/components/precache/core/precache_database.cc index 80be637..aba25db 100644 --- a/components/precache/core/precache_database.cc +++ b/components/precache/core/precache_database.cc @@ -100,7 +100,8 @@ void PrecacheDatabase::RecordURLPrecached(const GURL& url, if (!was_cached) { // The precache only counts as overhead if it was downloaded over the // network. - UMA_HISTOGRAM_COUNTS("Precache.DownloadedPrecacheMotivated", size); + UMA_HISTOGRAM_COUNTS("Precache.DownloadedPrecacheMotivated", + static_cast<base::HistogramBase::Sample>(size)); } // Use the URL table to keep track of URLs that are in the cache thanks to @@ -133,21 +134,24 @@ void PrecacheDatabase::RecordURLFetched(const GURL& url, return; } + base::HistogramBase::Sample size_sample = + static_cast<base::HistogramBase::Sample>(size); if (!was_cached) { // The fetch was served over the network during user browsing, so count it // as downloaded non-precache bytes. - UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache", size); + UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache", size_sample); if (is_connection_cellular) { - UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache.Cellular", size); + UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache.Cellular", + size_sample); } } else { // The fetch was served from the cache, and since there's an entry for this // URL in the URL table, this means that the resource was served from the // cache only because precaching put it there. Thus, precaching was helpful, // so count the fetch as saved bytes. - UMA_HISTOGRAM_COUNTS("Precache.Saved", size); + UMA_HISTOGRAM_COUNTS("Precache.Saved", size_sample); if (is_connection_cellular) { - UMA_HISTOGRAM_COUNTS("Precache.Saved.Cellular", size); + UMA_HISTOGRAM_COUNTS("Precache.Saved.Cellular", size_sample); } } diff --git a/components/storage_monitor/test_volume_mount_watcher_win.cc b/components/storage_monitor/test_volume_mount_watcher_win.cc index 746af6c..77ea57b 100644 --- a/components/storage_monitor/test_volume_mount_watcher_win.cc +++ b/components/storage_monitor/test_volume_mount_watcher_win.cc @@ -62,7 +62,8 @@ bool GetMassStorageDeviceDetails(const base::FilePath& device_path, base::FilePath path(device_path); if (device_path.value().length() > 3) path = base::FilePath(device_path.value().substr(0, 3)); - if (path.value()[0] < L'A' || path.value()[0] > L'Z') + base::FilePath::CharType drive_letter = path.value()[0]; + if (drive_letter < L'A' || drive_letter > L'Z') return false; StorageInfo::Type type = StorageInfo::FIXED_MASS_STORAGE; @@ -73,7 +74,7 @@ bool GetMassStorageDeviceDetails(const base::FilePath& device_path, } std::string unique_id = "\\\\?\\Volume{00000000-0000-0000-0000-000000000000}\\"; - unique_id[11] = device_path.value()[0]; + unique_id[11] = static_cast<char>(drive_letter); std::string device_id = StorageInfo::MakeDeviceId(type, unique_id); base::string16 storage_label = path.Append(L" Drive").LossyDisplayName(); *info = StorageInfo(device_id, path.value(), storage_label, base::string16(), diff --git a/components/storage_monitor/volume_mount_watcher_win.cc b/components/storage_monitor/volume_mount_watcher_win.cc index 87820c4..14225c6 100644 --- a/components/storage_monitor/volume_mount_watcher_win.cc +++ b/components/storage_monitor/volume_mount_watcher_win.cc @@ -343,7 +343,7 @@ base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) { if (drive_number < 0 || drive_number > 25) return base::FilePath(); base::string16 path(L"_:\\"); - path[0] = L'A' + drive_number; + path[0] = static_cast<base::char16>('A' + drive_number); return base::FilePath(path); } diff --git a/components/translate/core/common/translate_metrics.cc b/components/translate/core/common/translate_metrics.cc index 12b6300..f17a11e 100644 --- a/components/translate/core/common/translate_metrics.cc +++ b/components/translate/core/common/translate_metrics.cc @@ -82,19 +82,22 @@ void ReportLanguageVerification(LanguageVerificationType type) { void ReportTimeToBeReady(double time_in_msec) { UMA_HISTOGRAM_MEDIUM_TIMES( kTranslateTimeToBeReady, - base::TimeDelta::FromMicroseconds(time_in_msec * 1000.0)); + base::TimeDelta::FromMicroseconds( + static_cast<int64>(time_in_msec * 1000.0))); } void ReportTimeToLoad(double time_in_msec) { UMA_HISTOGRAM_MEDIUM_TIMES( kTranslateTimeToLoad, - base::TimeDelta::FromMicroseconds(time_in_msec * 1000.0)); + base::TimeDelta::FromMicroseconds( + static_cast<int64>(time_in_msec * 1000.0))); } void ReportTimeToTranslate(double time_in_msec) { UMA_HISTOGRAM_MEDIUM_TIMES( kTranslateTimeToTranslate, - base::TimeDelta::FromMicroseconds(time_in_msec * 1000.0)); + base::TimeDelta::FromMicroseconds( + static_cast<int64>(time_in_msec * 1000.0))); } void ReportUserActionDuration(base::TimeTicks begin, base::TimeTicks end) { |