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

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

Issue 146095: change backing store cache to be memory-based rather than count (Closed)
Patch Set: added better MemorySize() and comments Created 11 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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.h" 5 #include "chrome/browser/renderer_host/backing_store.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/gfx/gdi_util.h" 8 #include "base/gfx/gdi_util.h"
9 #include "chrome/browser/renderer_host/render_widget_host.h" 9 #include "chrome/browser/renderer_host/render_widget_host.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (original_bitmap_) { 67 if (original_bitmap_) {
68 SelectObject(hdc_, original_bitmap_); 68 SelectObject(hdc_, original_bitmap_);
69 } 69 }
70 if (backing_store_dib_) { 70 if (backing_store_dib_) {
71 DeleteObject(backing_store_dib_); 71 DeleteObject(backing_store_dib_);
72 backing_store_dib_ = NULL; 72 backing_store_dib_ = NULL;
73 } 73 }
74 DeleteDC(hdc_); 74 DeleteDC(hdc_);
75 } 75 }
76 76
77 size_t BackingStore::MemorySize() {
78 return size_.GetArea() * (color_depth_ / 8);
79 }
80
77 // static 81 // static
78 bool BackingStore::ColorManagementEnabled() { 82 bool BackingStore::ColorManagementEnabled() {
79 static bool enabled = false; 83 static bool enabled = false;
80 static bool checked = false; 84 static bool checked = false;
81 if (!checked) { 85 if (!checked) {
82 checked = true; 86 checked = true;
83 const CommandLine& command = *CommandLine::ForCurrentProcess(); 87 const CommandLine& command = *CommandLine::ForCurrentProcess();
84 enabled = command.HasSwitch(switches::kEnableMonitorProfile); 88 enabled = command.HasSwitch(switches::kEnableMonitorProfile);
85 } 89 }
86 return enabled; 90 return enabled;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect); 130 ScrollDC(hdc_, dx, dy, NULL, &r, NULL, &damaged_rect);
127 131
128 // TODO(darin): this doesn't work if dx and dy are both non-zero! 132 // TODO(darin): this doesn't work if dx and dy are both non-zero!
129 DCHECK(dx == 0 || dy == 0); 133 DCHECK(dx == 0 || dy == 0);
130 134
131 // We expect that damaged_rect should equal bitmap_rect. 135 // We expect that damaged_rect should equal bitmap_rect.
132 DCHECK(gfx::Rect(damaged_rect) == bitmap_rect); 136 DCHECK(gfx::Rect(damaged_rect) == bitmap_rect);
133 137
134 PaintRect(process, bitmap, bitmap_rect); 138 PaintRect(process, bitmap, bitmap_rect);
135 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698