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

Side by Side Diff: chrome/browser/ui/app_list/search/common/url_icon_source.cc

Issue 1067593005: Fix race conditions in ImageDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use TestBrowserThreadBundle, cleanup tests Created 5 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/app_list/search/common/url_icon_source.h" 5 #include "chrome/browser/ui/app_list/search/common/url_icon_source.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
11 #include "net/url_request/url_fetcher.h" 11 #include "net/url_request/url_fetcher.h"
12 #include "net/url_request/url_request_status.h" 12 #include "net/url_request/url_request_status.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/image/image_skia_operations.h" 14 #include "ui/gfx/image/image_skia_operations.h"
15 15
16 using content::BrowserThread; 16 using content::BrowserThread;
17 17
18 namespace app_list { 18 namespace app_list {
19 19
20 UrlIconSource::UrlIconSource(const IconLoadedCallback& icon_loaded_callback, 20 UrlIconSource::UrlIconSource(const IconLoadedCallback& icon_loaded_callback,
21 net::URLRequestContextGetter* context_getter, 21 net::URLRequestContextGetter* context_getter,
22 const GURL& icon_url, 22 const GURL& icon_url,
23 int icon_size, 23 int icon_size,
24 int default_icon_resource_id) 24 int default_icon_resource_id)
25 : ImageRequest( 25 : icon_loaded_callback_(icon_loaded_callback),
26 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)),
27 icon_loaded_callback_(icon_loaded_callback),
28 context_getter_(context_getter), 26 context_getter_(context_getter),
29 icon_url_(icon_url), 27 icon_url_(icon_url),
30 icon_size_(icon_size), 28 icon_size_(icon_size),
31 default_icon_resource_id_(default_icon_resource_id), 29 default_icon_resource_id_(default_icon_resource_id),
32 icon_fetch_attempted_(false) { 30 icon_fetch_attempted_(false) {
33 DCHECK(!icon_loaded_callback_.is_null()); 31 DCHECK(!icon_loaded_callback_.is_null());
34 } 32 }
35 33
36 UrlIconSource::~UrlIconSource() { 34 UrlIconSource::~UrlIconSource() {
37 } 35 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 gfx::Size(icon_size_, icon_size_)); 79 gfx::Size(icon_size_, icon_size_));
82 80
83 icon_loaded_callback_.Run(); 81 icon_loaded_callback_.Run();
84 } 82 }
85 83
86 void UrlIconSource::OnDecodeImageFailed() { 84 void UrlIconSource::OnDecodeImageFailed() {
87 // Failed to decode image. Do nothing and just use the default icon. 85 // Failed to decode image. Do nothing and just use the default icon.
88 } 86 }
89 87
90 } // namespace app_list 88 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698