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

Unified Diff: ui/gfx/icon_util.h

Issue 1372303002: Skip flushes on icon writes for 10x better jumplist perf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fixes Created 5 years, 3 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 | « chrome/browser/jumplist_win.cc ('k') | ui/gfx/icon_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/icon_util.h
diff --git a/ui/gfx/icon_util.h b/ui/gfx/icon_util.h
index a3dc30da6316d3ca8c8fce55e5a6118b91ad3aa2..1a48304735043801cb9b82f96dbb10dd49c8b50c 100644
--- a/ui/gfx/icon_util.h
+++ b/ui/gfx/icon_util.h
@@ -58,6 +58,11 @@ class SkBitmap;
///////////////////////////////////////////////////////////////////////////////
class GFX_EXPORT IconUtil {
public:
+ // ATOMIC_WRITE ensures that a partially written icon won't be created even if
+ // Chrome crashes part way through, but ATOMIC_WRITE is more expensive than
+ // NORMAL_WRITE. See CreateIconFileFromImageFamily. ATOMIC_WRITE is the
+ // default for historical reasons.
+ enum WriteType { ATOMIC_WRITE, NORMAL_WRITE };
// The size of the large icon entries in .ico files on Windows Vista+.
static const int kLargeIconSize = 256;
// The size of icons in the medium icons view on Windows Vista+. This is the
@@ -126,7 +131,8 @@ class GFX_EXPORT IconUtil {
// |image_family| is empty.
static bool CreateIconFileFromImageFamily(
const gfx::ImageFamily& image_family,
- const base::FilePath& icon_path);
+ const base::FilePath& icon_path,
+ WriteType write_type = ATOMIC_WRITE);
// Creates a cursor of the specified size from the DIB passed in.
// Returns the cursor on success or NULL on failure.
@@ -139,7 +145,7 @@ class GFX_EXPORT IconUtil {
// The icon format is published in the MSDN but there is no definition of
// the icon file structures in any of the Windows header files so we need to
// define these structure within the class. We must make sure we use 2 byte
- // packing so that the structures are layed out properly within the file.
+ // packing so that the structures are laid out properly within the file.
// See: http://msdn.microsoft.com/en-us/library/ms997538.aspx
#pragma pack(push)
#pragma pack(2)
« no previous file with comments | « chrome/browser/jumplist_win.cc ('k') | ui/gfx/icon_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698