summaryrefslogtreecommitdiffstats
path: root/ui/gfx/mac
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-30 00:42:31 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-30 00:42:31 +0000
commit74acd4f21a4d07ca0133eea3ffcde3927d8ba778 (patch)
tree373331a20dbdc08b366f5283ad23eee49829781f /ui/gfx/mac
parentc62206736bb74c6af9524cdff9f6789bdfac9fd6 (diff)
downloadchromium_src-74acd4f21a4d07ca0133eea3ffcde3927d8ba778.zip
chromium_src-74acd4f21a4d07ca0133eea3ffcde3927d8ba778.tar.gz
chromium_src-74acd4f21a4d07ca0133eea3ffcde3927d8ba778.tar.bz2
mac: Delete GetCachedImageWithName(), it's no longer used.
We used to load some images (mostly pdfs) from the app bundle instead of from a pak file. We now load everything* from pak files, so this is no longer necessary. *: We still load 4 pdf files from the bundle via nib files, see issue 111101. BUG=138772 TBR=avi Review URL: https://codereview.chromium.org/12096047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179484 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/mac')
-rw-r--r--ui/gfx/mac/nsimage_cache.h34
-rw-r--r--ui/gfx/mac/nsimage_cache.mm74
2 files changed, 0 insertions, 108 deletions
diff --git a/ui/gfx/mac/nsimage_cache.h b/ui/gfx/mac/nsimage_cache.h
deleted file mode 100644
index e43781f..0000000
--- a/ui/gfx/mac/nsimage_cache.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GFX_MAC_NSIMAGE_CACHE_H_
-#define UI_GFX_MAC_NSIMAGE_CACHE_H_
-
-#include "ui/base/ui_export.h"
-
-#ifdef __OBJC__
-@class NSImage;
-@class NSString;
-#else
-class NSImage;
-class NSString;
-#endif
-
-namespace gfx {
-
-// Returns an autoreleased image from the framework bundle
-// (base::mac::FrameworkBundle()) with the given name, and keeps it in memory so
-// future fetches are fast.
-// NOTE:
-// - This should only be called on the main thread.
-// - The caller should retain the image if they want to keep it around, as
-// the cache could have limit on size/lifetime, etc.
-UI_EXPORT NSImage* GetCachedImageWithName(NSString* name);
-
-// Clears the image cache.
-UI_EXPORT void ClearCachedImages(void);
-
-} // namespace gfx
-
-#endif // UI_GFX_MAC_NSIMAGE_CACHE_H_
diff --git a/ui/gfx/mac/nsimage_cache.mm b/ui/gfx/mac/nsimage_cache.mm
deleted file mode 100644
index 997a548..0000000
--- a/ui/gfx/mac/nsimage_cache.mm
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gfx/mac/nsimage_cache.h"
-
-#import <AppKit/AppKit.h>
-
-#include "base/logging.h"
-#include "base/mac/bundle_locations.h"
-#include "base/mac/mac_util.h"
-
-// When C++ exceptions are disabled, the C++ library defines |try| and
-// |catch| so as to allow exception-expecting C++ code to build properly when
-// language support for exceptions is not present. These macros interfere
-// with the use of |@try| and |@catch| in Objective-C files such as this one.
-// Undefine these macros here, after everything has been #included, since
-// there will be no C++ uses and only Objective-C uses from this point on.
-#undef try
-#undef catch
-
-namespace gfx {
-
-static NSMutableDictionary* image_cache = nil;
-
-NSImage* GetCachedImageWithName(NSString* name) {
- DCHECK(name);
-
- // NOTE: to make this thread safe, we'd have to sync on the cache and
- // also force all the bundle calls on the main thread.
-
- if (!image_cache) {
- image_cache = [[NSMutableDictionary alloc] init];
- DCHECK(image_cache);
- }
-
- NSImage* result = [image_cache objectForKey:name];
- if (!result) {
- DVLOG_IF(1, [[name pathExtension] length] == 0) << "Suggest including the "
- "extension in the image name";
-
- NSString* path = [base::mac::FrameworkBundle() pathForImageResource:name];
- if (path) {
- @try {
- result = [[[NSImage alloc] initWithContentsOfFile:path] autorelease];
- if (result) {
- // Auto-template images with names ending in "Template".
- NSString* extensionlessName = [name stringByDeletingPathExtension];
- if ([extensionlessName hasSuffix:@"Template"])
- [result setTemplate:YES];
-
- [image_cache setObject:result forKey:name];
- }
- }
- @catch (id err) {
- DLOG(ERROR) << "Failed to load the image for name '"
- << [name UTF8String] << "' from path '" << [path UTF8String]
- << "', error: " << [[err description] UTF8String];
- result = nil;
- }
- }
- }
-
- // TODO: if we ever limit the cache size, this should retain & autorelease
- // the image.
- return result;
-}
-
-void ClearCachedImages(void) {
- // NOTE: to make this thread safe, we'd have to sync on the cache.
- [image_cache removeAllObjects];
-}
-
-} // namespace gfx