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

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

Issue 3834003: On Windows, create a new TransportDIB::Handle struct which includes the file (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Rebase Created 10 years, 2 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer_host/backing_store_manager.h" 5 #include "chrome/browser/renderer_host/backing_store_manager.h"
6 6
7 #include "base/sys_info.h" 7 #include "base/sys_info.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/browser/renderer_host/backing_store.h" 10 #include "chrome/browser/renderer_host/backing_store.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 backing_store = NULL; 186 backing_store = NULL;
187 } 187 }
188 188
189 return backing_store; 189 return backing_store;
190 } 190 }
191 191
192 // static 192 // static
193 void BackingStoreManager::PrepareBackingStore( 193 void BackingStoreManager::PrepareBackingStore(
194 RenderWidgetHost* host, 194 RenderWidgetHost* host,
195 const gfx::Size& backing_store_size, 195 const gfx::Size& backing_store_size,
196 TransportDIB::Id bitmap, 196 TransportDIB::Id dib_id,
197 TransportDIB::Handle dib_handle,
197 const gfx::Rect& bitmap_rect, 198 const gfx::Rect& bitmap_rect,
198 const std::vector<gfx::Rect>& copy_rects, 199 const std::vector<gfx::Rect>& copy_rects,
199 bool* needs_full_paint, 200 bool* needs_full_paint,
200 bool* painted_synchronously) { 201 bool* painted_synchronously) {
201 // Default to declaring we're done using the transport DIB so it can be freed. 202 // Default to declaring we're done using the transport DIB so it can be freed.
202 *painted_synchronously = true; 203 *painted_synchronously = true;
203 204
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 DCHECK(needs_full_paint != NULL); 212 DCHECK(needs_full_paint != NULL);
212 *needs_full_paint = true; 213 *needs_full_paint = true;
213 // Makes no sense to paint the transport dib if we are going 214 // Makes no sense to paint the transport dib if we are going
214 // to request a full paint. 215 // to request a full paint.
215 return; 216 return;
216 } 217 }
217 backing_store = CreateBackingStore(host, backing_store_size); 218 backing_store = CreateBackingStore(host, backing_store_size);
218 } 219 }
219 220
220 backing_store->PaintToBackingStore(host->process(), bitmap, 221 backing_store->PaintToBackingStore(host->process(),
221 bitmap_rect, copy_rects, 222 dib_id,
223 dib_handle,
224 bitmap_rect,
225 copy_rects,
222 painted_synchronously); 226 painted_synchronously);
223 } 227 }
224 228
225 // static 229 // static
226 BackingStore* BackingStoreManager::Lookup(RenderWidgetHost* host) { 230 BackingStore* BackingStoreManager::Lookup(RenderWidgetHost* host) {
227 if (large_cache) { 231 if (large_cache) {
228 BackingStoreCache::iterator it = large_cache->Get(host); 232 BackingStoreCache::iterator it = large_cache->Get(host);
229 if (it != large_cache->end()) 233 if (it != large_cache->end())
230 return it->second; 234 return it->second;
231 235
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 size_t mem = 0; 288 size_t mem = 0;
285 BackingStoreCache::iterator it; 289 BackingStoreCache::iterator it;
286 for (it = large_cache->begin(); it != large_cache->end(); ++it) 290 for (it = large_cache->begin(); it != large_cache->end(); ++it)
287 mem += it->second->MemorySize(); 291 mem += it->second->MemorySize();
288 292
289 for (it = small_cache->begin(); it != small_cache->end(); ++it) 293 for (it = small_cache->begin(); it != small_cache->end(); ++it)
290 mem += it->second->MemorySize(); 294 mem += it->second->MemorySize();
291 295
292 return mem; 296 return mem;
293 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698