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

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

Issue 14689004: Re-land: cc: Cancel and re-prioritize worker pool tasks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move alignment check to RP Created 7 years, 7 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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 WebGraphicsContext3D* context3d = output_surface_->context3d(); 959 WebGraphicsContext3D* context3d = output_surface_->context3d();
960 DCHECK(context3d); 960 DCHECK(context3d);
961 DCHECK(resource->gl_pixel_buffer_id); 961 DCHECK(resource->gl_pixel_buffer_id);
962 context3d->bindBuffer( 962 context3d->bindBuffer(
963 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 963 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
964 resource->gl_pixel_buffer_id); 964 resource->gl_pixel_buffer_id);
965 uint8_t* image = static_cast<uint8_t*>( 965 uint8_t* image = static_cast<uint8_t*>(
966 context3d->mapBufferCHROMIUM( 966 context3d->mapBufferCHROMIUM(
967 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, GL_WRITE_ONLY)); 967 GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, GL_WRITE_ONLY));
968 context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); 968 context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
969 // Buffer is required to be 4-byte aligned.
970 CHECK(!(reinterpret_cast<intptr_t>(image) & 3));
969 return image; 971 return image;
970 } 972 }
971 973
972 if (resource->pixels) 974 if (resource->pixels)
973 return resource->pixel_buffer; 975 return resource->pixel_buffer;
974 976
975 return NULL; 977 return NULL;
976 } 978 }
977 979
978 void ResourceProvider::UnmapPixelBuffer(ResourceId id) { 980 void ResourceProvider::UnmapPixelBuffer(ResourceId id) {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id, 1238 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id,
1237 bool enable) { 1239 bool enable) {
1238 DCHECK(thread_checker_.CalledOnValidThread()); 1240 DCHECK(thread_checker_.CalledOnValidThread());
1239 ResourceMap::iterator it = resources_.find(id); 1241 ResourceMap::iterator it = resources_.find(id);
1240 CHECK(it != resources_.end()); 1242 CHECK(it != resources_.end());
1241 Resource* resource = &it->second; 1243 Resource* resource = &it->second;
1242 resource->enable_read_lock_fences = enable; 1244 resource->enable_read_lock_fences = enable;
1243 } 1245 }
1244 1246
1245 } // namespace cc 1247 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698