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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 12642010: Implement on demand quad rasterization for PicturePiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & introduce ResizeResource. Created 7 years, 9 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ResourceId id = next_id_++; 262 ResourceId id = next_id_++;
263 unsigned texture_id = 0; 263 unsigned texture_id = 0;
264 Resource resource(texture_id, gfx::Size(), 0, GL_LINEAR); 264 Resource resource(texture_id, gfx::Size(), 0, GL_LINEAR);
265 resource.external = true; 265 resource.external = true;
266 resource.allocated = true; 266 resource.allocated = true;
267 resource.mailbox = mailbox; 267 resource.mailbox = mailbox;
268 resources_[id] = resource; 268 resources_[id] = resource;
269 return id; 269 return id;
270 } 270 }
271 271
272 void ResourceProvider::ResizeResource(ResourceId id, gfx::Size size) {
273 DCHECK_LE(size.width(), max_texture_size_);
274 DCHECK_LE(size.height(), max_texture_size_);
piman 2013/03/22 18:03:03 Note: you're only handling GL resources. You shoul
Leandro Graciá Gil 2013/03/22 20:40:58 Done.
275 DCHECK(thread_checker_.CalledOnValidThread());
276 ResourceMap::iterator it = resources_.find(id);
277 CHECK(it != resources_.end());
278 Resource* resource = &it->second;
279 DCHECK(!resource->lock_for_read_count);
280 DCHECK(!resource->marked_for_deletion);
281 DCHECK(resource->pending_set_pixels || !resource->locked_for_write);
piman 2013/03/22 18:03:03 I'm not sure about this if pending_set_pixels is s
epenner 2013/03/22 22:31:00 I added reveman to review as well. I believe the
282 DCHECK(!resource->exported);
piman 2013/03/22 18:03:03 Check that it's not external (you shouldn't be res
Leandro Graciá Gil 2013/03/22 20:40:58 Done.
283
284 if (resource->size != size) {
285 resource->size = size;
286 resource->allocated = false;
piman 2013/03/22 18:03:03 This is ok for GL resources (LazyAllocate will res
Leandro Graciá Gil 2013/03/22 20:40:58 Done.
287 }
288 }
289
272 void ResourceProvider::DeleteResource(ResourceId id) { 290 void ResourceProvider::DeleteResource(ResourceId id) {
273 DCHECK(thread_checker_.CalledOnValidThread()); 291 DCHECK(thread_checker_.CalledOnValidThread());
274 ResourceMap::iterator it = resources_.find(id); 292 ResourceMap::iterator it = resources_.find(id);
275 CHECK(it != resources_.end()); 293 CHECK(it != resources_.end());
276 Resource* resource = &it->second; 294 Resource* resource = &it->second;
277 DCHECK(!resource->lock_for_read_count); 295 DCHECK(!resource->lock_for_read_count);
278 DCHECK(!resource->marked_for_deletion); 296 DCHECK(!resource->marked_for_deletion);
279 DCHECK(resource->pending_set_pixels || !resource->locked_for_write); 297 DCHECK(resource->pending_set_pixels || !resource->locked_for_write);
280 298
281 if (resource->exported) { 299 if (resource->exported) {
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id, 1220 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id,
1203 bool enable) { 1221 bool enable) {
1204 DCHECK(thread_checker_.CalledOnValidThread()); 1222 DCHECK(thread_checker_.CalledOnValidThread());
1205 ResourceMap::iterator it = resources_.find(id); 1223 ResourceMap::iterator it = resources_.find(id);
1206 CHECK(it != resources_.end()); 1224 CHECK(it != resources_.end());
1207 Resource* resource = &it->second; 1225 Resource* resource = &it->second;
1208 resource->enable_read_lock_fences = enable; 1226 resource->enable_read_lock_fences = enable;
1209 } 1227 }
1210 1228
1211 } // namespace cc 1229 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698