| OLD | NEW |
| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 context3d->shallowFlushCHROMIUM(); | 450 context3d->shallowFlushCHROMIUM(); |
| 451 return true; | 451 return true; |
| 452 } | 452 } |
| 453 | 453 |
| 454 const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) { | 454 const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) { |
| 455 DCHECK(thread_checker_.CalledOnValidThread()); | 455 DCHECK(thread_checker_.CalledOnValidThread()); |
| 456 ResourceMap::iterator it = resources_.find(id); | 456 ResourceMap::iterator it = resources_.find(id); |
| 457 CHECK(it != resources_.end()); | 457 CHECK(it != resources_.end()); |
| 458 Resource* resource = &it->second; | 458 Resource* resource = &it->second; |
| 459 DCHECK(!resource->locked_for_write || resource->set_pixels_completion_forced); | 459 DCHECK(!resource->locked_for_write || |
| 460 resource->set_pixels_completion_forced) << |
| 461 "locked for write: " << resource->locked_for_write << |
| 462 " pixels completion forced: " << resource->set_pixels_completion_forced; |
| 460 DCHECK(!resource->exported); | 463 DCHECK(!resource->exported); |
| 461 // Uninitialized! Call SetPixels or LockForWrite first. | 464 // Uninitialized! Call SetPixels or LockForWrite first. |
| 462 DCHECK(resource->allocated); | 465 DCHECK(resource->allocated); |
| 463 | 466 |
| 464 if (!resource->gl_id && resource->external && !resource->mailbox.IsEmpty()) { | 467 if (!resource->gl_id && resource->external && !resource->mailbox.IsEmpty()) { |
| 465 WebGraphicsContext3D* context3d = output_surface_->context3d(); | 468 WebGraphicsContext3D* context3d = output_surface_->context3d(); |
| 466 DCHECK(context3d); | 469 DCHECK(context3d); |
| 467 if (resource->mailbox.sync_point()) { | 470 if (resource->mailbox.sync_point()) { |
| 468 GLC(context3d, context3d->waitSyncPoint(resource->mailbox.sync_point())); | 471 GLC(context3d, context3d->waitSyncPoint(resource->mailbox.sync_point())); |
| 469 resource->mailbox.ResetSyncPoint(); | 472 resource->mailbox.ResetSyncPoint(); |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id, | 1224 void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id, |
| 1222 bool enable) { | 1225 bool enable) { |
| 1223 DCHECK(thread_checker_.CalledOnValidThread()); | 1226 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1224 ResourceMap::iterator it = resources_.find(id); | 1227 ResourceMap::iterator it = resources_.find(id); |
| 1225 CHECK(it != resources_.end()); | 1228 CHECK(it != resources_.end()); |
| 1226 Resource* resource = &it->second; | 1229 Resource* resource = &it->second; |
| 1227 resource->enable_read_lock_fences = enable; | 1230 resource->enable_read_lock_fences = enable; |
| 1228 } | 1231 } |
| 1229 | 1232 |
| 1230 } // namespace cc | 1233 } // namespace cc |
| OLD | NEW |