OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/icon_loader.h" | 5 #include "chrome/browser/icon_loader.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 LAZY_INSTANCE_INITIALIZER; | 196 LAZY_INSTANCE_INITIALIZER; |
197 int idr = icon_mapper.Get().Lookup(group_, icon_size_); | 197 int idr = icon_mapper.Get().Lookup(group_, icon_size_); |
198 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 198 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
199 scoped_refptr<base::RefCountedStaticMemory> bytes( | 199 scoped_refptr<base::RefCountedStaticMemory> bytes( |
200 rb.LoadDataResourceBytes(idr)); | 200 rb.LoadDataResourceBytes(idr)); |
201 DCHECK(bytes.get()); | 201 DCHECK(bytes.get()); |
202 SkBitmap bitmap; | 202 SkBitmap bitmap; |
203 if (!gfx::PNGCodec::Decode(bytes->front(), bytes->size(), &bitmap)) | 203 if (!gfx::PNGCodec::Decode(bytes->front(), bytes->size(), &bitmap)) |
204 NOTREACHED(); | 204 NOTREACHED(); |
205 image_.reset(new gfx::Image( | 205 image_.reset(new gfx::Image( |
206 GenerateBitmapWithSize(&bitmap, IconSizeToPixelSize(icon_size_)))); | 206 *GenerateBitmapWithSize(&bitmap, IconSizeToPixelSize(icon_size_)))); |
sky
2012/05/04 16:18:23
Doesn't this leak now?
| |
207 target_message_loop_->PostTask( | 207 target_message_loop_->PostTask( |
208 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); | 208 FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); |
209 } | 209 } |
OLD | NEW |