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

Unified Diff: ui/gfx/gtk_util.cc

Issue 9804003: ui/gfx: Add a typedef of std::map to improve the readability of GdkCursorCache implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm unused base/linux_util.h Created 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gtk_util.cc
diff --git a/ui/gfx/gtk_util.cc b/ui/gfx/gtk_util.cc
index 0b133cb664c4c15c61ee9d372c0fa3215df69cd9..2cee36caf12a49178e2b53ec6e061bde56701da5 100644
--- a/ui/gfx/gtk_util.cc
+++ b/ui/gfx/gtk_util.cc
@@ -10,7 +10,6 @@
#include "base/basictypes.h"
#include "base/command_line.h"
-#include "base/linux_util.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkUnPreMultiply.h"
@@ -18,26 +17,25 @@
namespace {
-// A process wide singleton that manages our usage of gdk
-// cursors. gdk_cursor_new() hits the disk in several places and GdkCursor
-// instances can be reused throughout the process.
+// A process wide singleton that manages our usage of gdk cursors.
+// gdk_cursor_new() hits the disk in several places and GdkCursor instances can
+// be reused throughout the process.
class GdkCursorCache {
public:
- GdkCursorCache() {}
+ GdkCursorCache() {}
~GdkCursorCache() {
- for (std::map<GdkCursorType, GdkCursor*>::iterator it =
- cursor_cache_.begin(); it != cursor_cache_.end(); ++it) {
- gdk_cursor_unref(it->second);
+ for (GdkCursorMap::iterator i(cursors_.begin()); i != cursors_.end(); ++i) {
+ gdk_cursor_unref(i->second);
}
- cursor_cache_.clear();
+ cursors_.clear();
}
GdkCursor* GetCursorImpl(GdkCursorType type) {
- std::map<GdkCursorType, GdkCursor*>::iterator it = cursor_cache_.find(type);
+ GdkCursorMap::iterator it = cursors_.find(type);
GdkCursor* cursor = NULL;
- if (it == cursor_cache_.end()) {
+ if (it == cursors_.end()) {
cursor = gdk_cursor_new(type);
- cursor_cache_.insert(std::make_pair(type, cursor));
+ cursors_.insert(std::make_pair(type, cursor));
} else {
cursor = it->second;
}
@@ -47,7 +45,9 @@ class GdkCursorCache {
return cursor;
}
- std::map<GdkCursorType, GdkCursor*> cursor_cache_;
+ private:
+ typedef std::map<GdkCursorType, GdkCursor*> GdkCursorMap;
+ GdkCursorMap cursors_;
DISALLOW_COPY_AND_ASSIGN(GdkCursorCache);
};
« 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