Chromium Code Reviews| Index: chrome/browser/cocoa/browser_window_controller.mm | 
| =================================================================== | 
| --- chrome/browser/cocoa/browser_window_controller.mm (revision 24242) | 
| +++ chrome/browser/cocoa/browser_window_controller.mm (working copy) | 
| @@ -1202,7 +1202,16 @@ | 
| @implementation GTMTheme (BrowserThemeProviderInitialization) | 
| + (GTMTheme *)themeWithBrowserThemeProvider:(BrowserThemeProvider*)provider | 
| isOffTheRecord:(BOOL)isOffTheRecord { | 
| - GTMTheme *theme = [[[GTMTheme alloc] init] autorelease]; | 
| + // First check if it's in the cache. | 
| + typedef std::pair<std::string, BOOL> ThemeKey; | 
| + static std::map<ThemeKey, GTMTheme*> cache; | 
| 
 
Mark Mentovai
2009/08/26 01:25:49
I think that every place we have a static that lea
 
pink (ping after 24hrs)
2009/08/26 14:55:56
Done.
 
 | 
| + ThemeKey key(provider->GetThemeID(), isOffTheRecord); | 
| + GTMTheme* theme = cache[key]; | 
| + if (theme) | 
| + return theme; | 
| + | 
| + theme = [[GTMTheme alloc] init]; // "Leak" it in the cache. | 
| + cache[key] = theme; | 
| if (isOffTheRecord) { | 
| NSColor* incognitoColor = [NSColor colorWithCalibratedRed:83/255.0 | 
| green:108.0/255.0 |