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

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

Issue 2559523002: Send overlay promotion hints from to GLStreamTextureImage. (Closed)
Patch Set: reverted media Created 4 years 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 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 1670
1671 for (const auto& children : resources_for_child) { 1671 for (const auto& children : resources_for_child) {
1672 ChildMap::iterator child_it = children_.find(children.first); 1672 ChildMap::iterator child_it = children_.find(children.first);
1673 DCHECK(child_it != children_.end()); 1673 DCHECK(child_it != children_.end());
1674 DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, children.second); 1674 DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, children.second);
1675 } 1675 }
1676 } 1676 }
1677 1677
1678 #if defined(OS_ANDROID) 1678 #if defined(OS_ANDROID)
1679 void ResourceProvider::SendPromotionHints( 1679 void ResourceProvider::SendPromotionHints(
1680 const ResourceIdSet& promotable_hints) { 1680 const OverlayCandidateList::PromotionHintInfoMap& promotion_hints) {
1681 GLES2Interface* gl = ContextGL();
1682 if (!gl)
1683 return;
1684
1681 for (const auto& id : wants_promotion_hints_set_) { 1685 for (const auto& id : wants_promotion_hints_set_) {
1686 const ResourceMap::iterator it = resources_.find(id);
1687 if (it == resources_.end())
1688 continue;
1689
1690 if (it->second.marked_for_deletion)
1691 continue;
1692
1682 const Resource* resource = LockForRead(id); 1693 const Resource* resource = LockForRead(id);
1683 DCHECK(resource->wants_promotion_hint); 1694 DCHECK(resource->wants_promotion_hint);
1684 1695
1685 // Insist that this is backed by a GPU texture. 1696 // Insist that this is backed by a GPU texture.
1686 if (IsGpuResourceType(resource->type)) { 1697 if (IsGpuResourceType(resource->type)) {
1687 DCHECK(resource->gl_id); 1698 DCHECK(resource->gl_id);
1688 // TODO(liberato): Here we would either construct a set to send all at 1699 auto iter = promotion_hints.find(id);
1689 // once, or send the promotion hint individually to resource->gl_id, based 1700 bool promotable = iter != promotion_hints.end();
1690 // on whether promtable_hints.count(it->first) > 0 . 1701 gl->SendOverlayPromotionHintCHROMIUM(resource->gl_id, promotable,
1691 // crbug.com/671357 1702 promotable ? iter->second.x() : 0,
1703 promotable ? iter->second.y() : 0);
1692 } 1704 }
1693 UnlockForRead(id); 1705 UnlockForRead(id);
1694 } 1706 }
1695 } 1707 }
1696 #endif 1708 #endif
1697 1709
1698 void ResourceProvider::CreateMailboxAndBindResource( 1710 void ResourceProvider::CreateMailboxAndBindResource(
1699 gpu::gles2::GLES2Interface* gl, 1711 gpu::gles2::GLES2Interface* gl,
1700 Resource* resource) { 1712 Resource* resource) {
1701 DCHECK(IsGpuResourceType(resource->type)); 1713 DCHECK(IsGpuResourceType(resource->type));
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 2149
2138 const int kImportance = 2; 2150 const int kImportance = 2;
2139 pmd->CreateSharedGlobalAllocatorDump(guid); 2151 pmd->CreateSharedGlobalAllocatorDump(guid);
2140 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 2152 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
2141 } 2153 }
2142 2154
2143 return true; 2155 return true;
2144 } 2156 }
2145 2157
2146 } // namespace cc 2158 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698