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

Side by Side Diff: chrome/browser/web_applications/update_shortcut_worker_win.cc

Issue 1771033003: gfx::Image: Added thread checker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove UpdateShortcutWorker changes; instead just disable thread checking. Created 3 years, 5 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
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/web_applications/web_app.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/web_applications/update_shortcut_worker_win.h" 5 #include "chrome/browser/web_applications/update_shortcut_worker_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // to download the icon. 79 // to download the icon.
80 DCHECK_CURRENTLY_ON(BrowserThread::UI); 80 DCHECK_CURRENTLY_ON(BrowserThread::UI);
81 81
82 if (!web_contents_) { 82 if (!web_contents_) {
83 DeleteMe(); // We are done if underlying WebContents is gone. 83 DeleteMe(); // We are done if underlying WebContents is gone.
84 return; 84 return;
85 } 85 }
86 86
87 if (unprocessed_icons_.empty()) { 87 if (unprocessed_icons_.empty()) {
88 // No app icon. Just use the favicon from WebContents. 88 // No app icon. Just use the favicon from WebContents.
89 // TODO(mgiuca): This Image is passed to the FILE thread while still being
90 // used on the UI thread. This is not thread-safe and needs to be fixed.
91 // Remove this thread-check disable. https://crbug.com/596348.
92 shortcut_info_->favicon.DisableThreadChecking();
89 UpdateShortcuts(); 93 UpdateShortcuts();
90 return; 94 return;
91 } 95 }
92 96
93 int preferred_size = std::max(unprocessed_icons_.back().width, 97 int preferred_size = std::max(unprocessed_icons_.back().width,
94 unprocessed_icons_.back().height); 98 unprocessed_icons_.back().height);
95 web_contents_->DownloadImage( 99 web_contents_->DownloadImage(
96 unprocessed_icons_.back().url, 100 unprocessed_icons_.back().url,
97 true, // favicon 101 true, // favicon
98 0, // no maximum size 102 0, // no maximum size
(...skipping 24 matching lines...) Expand all
123 original_sizes, requested_sizes_in_pixel, &closest_indices, NULL); 127 original_sizes, requested_sizes_in_pixel, &closest_indices, NULL);
124 128
125 SkBitmap bitmap; 129 SkBitmap bitmap;
126 if (!bitmaps.empty()) { 130 if (!bitmaps.empty()) {
127 size_t closest_index = closest_indices[0]; 131 size_t closest_index = closest_indices[0];
128 bitmap = bitmaps[closest_index]; 132 bitmap = bitmaps[closest_index];
129 } 133 }
130 134
131 if (!bitmap.isNull()) { 135 if (!bitmap.isNull()) {
132 // Update icon with download image and update shortcut. 136 // Update icon with download image and update shortcut.
133 shortcut_info_->favicon.Add(gfx::Image::CreateFrom1xBitmap(bitmap)); 137 gfx::Image icon = gfx::Image::CreateFrom1xBitmap(bitmap);
138 // |icon| will be used on the FILE thread, so detach it from this thread.
139 icon.DetachFromThread();
140 shortcut_info_->favicon.Add(icon);
134 extensions::TabHelper* extensions_tab_helper = 141 extensions::TabHelper* extensions_tab_helper =
135 extensions::TabHelper::FromWebContents(web_contents_); 142 extensions::TabHelper::FromWebContents(web_contents_);
136 extensions_tab_helper->SetAppIcon(bitmap); 143 extensions_tab_helper->SetAppIcon(bitmap);
137 UpdateShortcuts(); 144 UpdateShortcuts();
138 } else { 145 } else {
139 // Try the next icon otherwise. 146 // Try the next icon otherwise.
140 DownloadIcon(); 147 DownloadIcon();
141 } 148 }
142 } 149 }
143 150
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 base::Unretained(this))); 253 base::Unretained(this)));
247 } 254 }
248 } 255 }
249 256
250 void UpdateShortcutWorker::DeleteMeOnUIThread() { 257 void UpdateShortcutWorker::DeleteMeOnUIThread() {
251 DCHECK_CURRENTLY_ON(BrowserThread::UI); 258 DCHECK_CURRENTLY_ON(BrowserThread::UI);
252 delete this; 259 delete this;
253 } 260 }
254 261
255 } // namespace web_app 262 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/web_applications/web_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698