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

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

Issue 1406013007: cc: Remove GL_TEXTURE_2D hard-coding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set upstream right Created 5 years, 1 month 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
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 resource->gpu_memory_buffer = NULL; 606 resource->gpu_memory_buffer = NULL;
607 } 607 }
608 resources_.erase(it); 608 resources_.erase(it);
609 } 609 }
610 610
611 ResourceProvider::ResourceType ResourceProvider::GetResourceType( 611 ResourceProvider::ResourceType ResourceProvider::GetResourceType(
612 ResourceId id) { 612 ResourceId id) {
613 return GetResource(id)->type; 613 return GetResource(id)->type;
614 } 614 }
615 615
616 GLenum ResourceProvider::GetResourceTextureTarget(ResourceId id) {
617 return GetResource(id)->target;
618 }
619
616 void ResourceProvider::CopyToResource(ResourceId id, 620 void ResourceProvider::CopyToResource(ResourceId id,
617 const uint8_t* image, 621 const uint8_t* image,
618 const gfx::Size& image_size) { 622 const gfx::Size& image_size) {
619 Resource* resource = GetResource(id); 623 Resource* resource = GetResource(id);
620 DCHECK(!resource->locked_for_write); 624 DCHECK(!resource->locked_for_write);
621 DCHECK(!resource->lock_for_read_count); 625 DCHECK(!resource->lock_for_read_count);
622 DCHECK(resource->origin == Resource::INTERNAL); 626 DCHECK(resource->origin == Resource::INTERNAL);
623 DCHECK_EQ(resource->exported_count, 0); 627 DCHECK_EQ(resource->exported_count, 0);
624 DCHECK(ReadLockFenceHasPassed(resource)); 628 DCHECK(ReadLockFenceHasPassed(resource));
625 629
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 if (resource->image_id && resource->dirty_image) 1445 if (resource->image_id && resource->dirty_image)
1442 BindImageForSampling(resource); 1446 BindImageForSampling(resource);
1443 1447
1444 return target; 1448 return target;
1445 } 1449 }
1446 1450
1447 void ResourceProvider::CreateForTesting(ResourceId id) { 1451 void ResourceProvider::CreateForTesting(ResourceId id) {
1448 LazyCreate(GetResource(id)); 1452 LazyCreate(GetResource(id));
1449 } 1453 }
1450 1454
1451 GLenum ResourceProvider::TargetForTesting(ResourceId id) {
1452 Resource* resource = GetResource(id);
1453 return resource->target;
1454 }
1455
1456 void ResourceProvider::LazyCreate(Resource* resource) { 1455 void ResourceProvider::LazyCreate(Resource* resource) {
1457 if (resource->type != RESOURCE_TYPE_GL_TEXTURE || 1456 if (resource->type != RESOURCE_TYPE_GL_TEXTURE ||
1458 resource->origin != Resource::INTERNAL) 1457 resource->origin != Resource::INTERNAL)
1459 return; 1458 return;
1460 1459
1461 if (resource->gl_id) 1460 if (resource->gl_id)
1462 return; 1461 return;
1463 1462
1464 DCHECK(resource->origin == Resource::INTERNAL); 1463 DCHECK(resource->origin == Resource::INTERNAL);
1465 DCHECK(!resource->mailbox.IsValid()); 1464 DCHECK(!resource->mailbox.IsValid());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 const int kImportance = 2; 1650 const int kImportance = 2;
1652 pmd->CreateSharedGlobalAllocatorDump(guid); 1651 pmd->CreateSharedGlobalAllocatorDump(guid);
1653 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1652 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1654 } 1653 }
1655 } 1654 }
1656 1655
1657 return true; 1656 return true;
1658 } 1657 }
1659 1658
1660 } // namespace cc 1659 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698