diff options
-rw-r--r-- | chrome/browser/icon_loader.cc | 15 | ||||
-rw-r--r-- | chrome/browser/icon_loader.h | 9 | ||||
-rw-r--r-- | chrome/browser/icon_loader_linux.cc | 6 | ||||
-rw-r--r-- | chrome/browser/icon_loader_mac.mm | 4 | ||||
-rw-r--r-- | chrome/browser/icon_loader_win.cc | 4 |
5 files changed, 19 insertions, 19 deletions
diff --git a/chrome/browser/icon_loader.cc b/chrome/browser/icon_loader.cc index 2281b89..ea22b69 100644 --- a/chrome/browser/icon_loader.cc +++ b/chrome/browser/icon_loader.cc @@ -1,12 +1,10 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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 "chrome/browser/icon_loader.h" -#include "base/message_loop.h" -#include "base/thread.h" -#include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_thread.h" #include "third_party/skia/include/core/SkBitmap.h" #if defined(TOOLKIT_GTK) @@ -23,22 +21,21 @@ IconLoader::IconLoader(const IconGroupID& group, IconSize size, } IconLoader::~IconLoader() { - delete bitmap_; } void IconLoader::Start() { - target_message_loop_ = MessageLoop::current(); + target_message_loop_ = base::MessageLoopProxy::CreateForCurrentThread(); #if defined(TOOLKIT_GTK) // This call must happen on the UI thread before we can start loading icons. mime_util::DetectGtkTheme(); #endif - g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, NewRunnableMethod(this, &IconLoader::ReadIcon)); } void IconLoader::NotifyDelegate() { - if (delegate_->OnBitmapLoaded(this, bitmap_)) - bitmap_ = NULL; + if (delegate_->OnBitmapLoaded(this, bitmap_.Get())) + bitmap_.Release(); } diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h index 32b4048..8d055e3 100644 --- a/chrome/browser/icon_loader.h +++ b/chrome/browser/icon_loader.h @@ -11,10 +11,13 @@ #include <string> #include "base/basictypes.h" +#include "base/message_loop_proxy.h" +#include "base/ref_counted.h" +#include "gfx/scoped_image.h" + #if defined(TOOLKIT_USES_GTK) #include "base/file_path.h" #endif -#include "base/ref_counted.h" #if defined(OS_WIN) // On Windows, we group files by their extension, with several exceptions: @@ -68,13 +71,13 @@ class IconLoader : public base::RefCountedThreadSafe<IconLoader> { void NotifyDelegate(); // The message loop object of the thread in which we notify the delegate. - MessageLoop* target_message_loop_; + scoped_refptr<base::MessageLoopProxy> target_message_loop_; IconGroupID group_; IconSize icon_size_; - SkBitmap* bitmap_; + gfx::ScopedImage<SkBitmap> bitmap_; Delegate* delegate_; diff --git a/chrome/browser/icon_loader_linux.cc b/chrome/browser/icon_loader_linux.cc index a4cf378..2452b4a 100644 --- a/chrome/browser/icon_loader_linux.cc +++ b/chrome/browser/icon_loader_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -66,8 +66,8 @@ void IconLoader::ParseIcon() { pixel_vector.resize(height * stride); memcpy(const_cast<unsigned char*>(pixel_vector.data()), BGRA_pixels, height * stride); - bitmap_ = gfx::PNGCodec::CreateSkBitmapFromBGRAFormat(pixel_vector, - width, height); + bitmap_.Set(gfx::PNGCodec::CreateSkBitmapFromBGRAFormat(pixel_vector, + width, height)); free(BGRA_pixels); } } else { diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm index 028edf7..441d12a 100644 --- a/chrome/browser/icon_loader_mac.mm +++ b/chrome/browser/icon_loader_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -25,7 +25,7 @@ void IconLoader::ReadIcon() { else return; - bitmap_ = new SkBitmap(gfx::NSImageToSkBitmap(icon, size, false)); + bitmap_.Set(new SkBitmap(gfx::NSImageToSkBitmap(icon, size, false))); target_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &IconLoader::NotifyDelegate)); diff --git a/chrome/browser/icon_loader_win.cc b/chrome/browser/icon_loader_win.cc index 6fb5824..dfa115c 100644 --- a/chrome/browser/icon_loader_win.cc +++ b/chrome/browser/icon_loader_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -42,7 +42,7 @@ void IconLoader::ReadIcon() { DCHECK(r); gfx::Size icon_size(bitmap_info.bmWidth, bitmap_info.bmHeight); - bitmap_ = IconUtil::CreateSkBitmapFromHICON(file_info.hIcon, icon_size); + bitmap_.Set(IconUtil::CreateSkBitmapFromHICON(file_info.hIcon, icon_size)); target_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &IconLoader::NotifyDelegate)); |