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

Side by Side Diff: chrome/browser/cocoa/nsimage_cache.mm

Issue 165330: Disable RTTI and C++ exceptions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/nsimage_cache.h ('k') | chrome/browser/profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/cocoa/nsimage_cache.h" 5 #include "chrome/browser/cocoa/nsimage_cache.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 9
10 // When C++ exceptions are disabled, the C++ library defines |try| and
11 // |catch| so as to allow exception-expecting C++ code to build properly when
12 // language support for exceptions is not present. These macros interfere
13 // with the use of |@try| and |@catch| in Objective-C files such as this one.
14 // Undefine these macros here, after everything has been #included, since
15 // there will be no C++ uses and only Objective-C uses from this point on.
16 #undef try
17 #undef catch
18
10 namespace nsimage_cache { 19 namespace nsimage_cache {
11 20
12 static NSMutableDictionary *image_cache = nil; 21 static NSMutableDictionary *image_cache = nil;
13 22
14 NSImage *ImageNamed(NSString *name) { 23 NSImage *ImageNamed(NSString *name) {
15 DCHECK(name); 24 DCHECK(name);
16 25
17 // NOTE: to make this thread safe, we'd have to sync on the cache and 26 // NOTE: to make this thread safe, we'd have to sync on the cache and
18 // also force all the bundle calls on the main thread. 27 // also force all the bundle calls on the main thread.
19 28
(...skipping 26 matching lines...) Expand all
46 // TODO: if we ever limit the cache size, this should retain & autorelease 55 // TODO: if we ever limit the cache size, this should retain & autorelease
47 // the image. 56 // the image.
48 return result; 57 return result;
49 } 58 }
50 59
51 void Clear(void) { 60 void Clear(void) {
52 // NOTE: to make this thread safe, we'd have to sync on the cache. 61 // NOTE: to make this thread safe, we'd have to sync on the cache.
53 [image_cache removeAllObjects]; 62 [image_cache removeAllObjects];
54 } 63 }
55 64
56 } // nsimage_cache 65 } // namespace nsimage_cache
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/nsimage_cache.h ('k') | chrome/browser/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698