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

Side by Side Diff: content/browser/renderer_host/backing_store_manager.cc

Issue 10540144: Tag TransportDIBs with the device scale factor they expect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 6 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
OLDNEW
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 "content/browser/renderer_host/backing_store_manager.h" 5 #include "content/browser/renderer_host/backing_store_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/mru_cache.h" 9 #include "base/memory/mru_cache.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return backing_store; 191 return backing_store;
192 } 192 }
193 193
194 // static 194 // static
195 void BackingStoreManager::PrepareBackingStore( 195 void BackingStoreManager::PrepareBackingStore(
196 RenderWidgetHost* host, 196 RenderWidgetHost* host,
197 const gfx::Size& backing_store_size, 197 const gfx::Size& backing_store_size,
198 TransportDIB::Id bitmap, 198 TransportDIB::Id bitmap,
199 const gfx::Rect& bitmap_rect, 199 const gfx::Rect& bitmap_rect,
200 const std::vector<gfx::Rect>& copy_rects, 200 const std::vector<gfx::Rect>& copy_rects,
201 float scale_factor,
201 const base::Closure& completion_callback, 202 const base::Closure& completion_callback,
202 bool* needs_full_paint, 203 bool* needs_full_paint,
203 bool* scheduled_completion_callback) { 204 bool* scheduled_completion_callback) {
204 BackingStore* backing_store = GetBackingStore(host, backing_store_size); 205 BackingStore* backing_store = GetBackingStore(host, backing_store_size);
205 if (!backing_store) { 206 if (!backing_store) {
206 // We need to get Webkit to generate a new paint here, as we 207 // We need to get Webkit to generate a new paint here, as we
207 // don't have a previous snapshot. 208 // don't have a previous snapshot.
208 if (bitmap_rect.size() != backing_store_size || 209 if (bitmap_rect.size() != backing_store_size ||
209 bitmap_rect.x() != 0 || bitmap_rect.y() != 0 || 210 bitmap_rect.x() != 0 || bitmap_rect.y() != 0 ||
210 ComputeTotalArea(copy_rects) != backing_store_size.GetArea() || 211 ComputeTotalArea(copy_rects) != backing_store_size.GetArea() ||
211 !(backing_store = CreateBackingStore(host, backing_store_size))) { 212 !(backing_store = CreateBackingStore(host, backing_store_size))) {
212 DCHECK(needs_full_paint != NULL); 213 DCHECK(needs_full_paint != NULL);
213 *needs_full_paint = true; 214 *needs_full_paint = true;
214 *scheduled_completion_callback = false; 215 *scheduled_completion_callback = false;
215 // Makes no sense to paint the transport dib if we are going 216 // Makes no sense to paint the transport dib if we are going
216 // to request a full paint. 217 // to request a full paint.
217 return; 218 return;
218 } 219 }
219 } 220 }
220 221
221 backing_store->PaintToBackingStore(host->GetProcess(), bitmap, 222 backing_store->PaintToBackingStore(host->GetProcess(), bitmap,
222 bitmap_rect, copy_rects, 223 bitmap_rect, copy_rects, scale_factor,
223 completion_callback, 224 completion_callback,
224 scheduled_completion_callback); 225 scheduled_completion_callback);
225 } 226 }
226 227
227 // static 228 // static
228 BackingStore* BackingStoreManager::Lookup(RenderWidgetHost* host) { 229 BackingStore* BackingStoreManager::Lookup(RenderWidgetHost* host) {
229 if (large_cache) { 230 if (large_cache) {
230 BackingStoreCache::iterator it = large_cache->Get(host); 231 BackingStoreCache::iterator it = large_cache->Get(host);
231 if (it != large_cache->end()) 232 if (it != large_cache->end())
232 return it->second; 233 return it->second;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 size_t mem = 0; 272 size_t mem = 0;
272 BackingStoreCache::iterator it; 273 BackingStoreCache::iterator it;
273 for (it = large_cache->begin(); it != large_cache->end(); ++it) 274 for (it = large_cache->begin(); it != large_cache->end(); ++it)
274 mem += it->second->MemorySize(); 275 mem += it->second->MemorySize();
275 276
276 for (it = small_cache->begin(); it != small_cache->end(); ++it) 277 for (it = small_cache->begin(); it != small_cache->end(); ++it)
277 mem += it->second->MemorySize(); 278 mem += it->second->MemorySize();
278 279
279 return mem; 280 return mem;
280 } 281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698