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

Side by Side Diff: chrome/browser/ui/cocoa/table_row_nsimage_cache.mm

Issue 6542027: Out of line cleanups for Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Killer rebase. :( Created 9 years, 10 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/ui/cocoa/table_row_nsimage_cache.h ('k') | chrome/chrome_browser.gypi » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ui/cocoa/table_row_nsimage_cache.h" 5 #include "chrome/browser/ui/cocoa/table_row_nsimage_cache.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "skia/ext/skia_utils_mac.h" 8 #include "skia/ext/skia_utils_mac.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 10
11 TableRowNSImageCache::TableRowNSImageCache(Table* model) 11 TableRowNSImageCache::TableRowNSImageCache(Table* model)
12 : model_(model), 12 : model_(model),
13 icon_images_([[NSPointerArray alloc] initWithOptions: 13 icon_images_([[NSPointerArray alloc] initWithOptions:
14 NSPointerFunctionsStrongMemory | 14 NSPointerFunctionsStrongMemory |
15 NSPointerFunctionsObjectPersonality]) { 15 NSPointerFunctionsObjectPersonality]) {
16 int count = model_->RowCount(); 16 int count = model_->RowCount();
17 [icon_images_ setCount:count]; 17 [icon_images_ setCount:count];
18 } 18 }
19 19
20 TableRowNSImageCache::~TableRowNSImageCache() {}
21
20 void TableRowNSImageCache::OnModelChanged() { 22 void TableRowNSImageCache::OnModelChanged() {
21 int count = model_->RowCount(); 23 int count = model_->RowCount();
22 [icon_images_ setCount:0]; 24 [icon_images_ setCount:0];
23 [icon_images_ setCount:count]; 25 [icon_images_ setCount:count];
24 } 26 }
25 27
26 void TableRowNSImageCache::OnItemsChanged(int start, int length) { 28 void TableRowNSImageCache::OnItemsChanged(int start, int length) {
27 DCHECK_LE(start + length, static_cast<int>([icon_images_ count])); 29 DCHECK_LE(start + length, static_cast<int>([icon_images_ count]));
28 for (int i = start; i < (start + length); ++i) { 30 for (int i = start; i < (start + length); ++i) {
29 [icon_images_ replacePointerAtIndex:i withPointer:NULL]; 31 [icon_images_ replacePointerAtIndex:i withPointer:NULL];
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Empty bitmaps are intentionally not cached. 72 // Empty bitmaps are intentionally not cached.
71 if (!bitmap_icon.isNull()) { 73 if (!bitmap_icon.isNull()) {
72 image = gfx::SkBitmapToNSImage(bitmap_icon); 74 image = gfx::SkBitmapToNSImage(bitmap_icon);
73 DCHECK(image); 75 DCHECK(image);
74 [icon_images_ replacePointerAtIndex:row withPointer:image]; 76 [icon_images_ replacePointerAtIndex:row withPointer:image];
75 } 77 }
76 } 78 }
77 return image; 79 return image;
78 } 80 }
79 81
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/table_row_nsimage_cache.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698