| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 967 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 968 created_sync_token = true; | 968 created_sync_token = true; |
| 969 } | 969 } |
| 970 | 970 |
| 971 resource->UpdateSyncToken(sync_token); | 971 resource->UpdateSyncToken(sync_token); |
| 972 resource->SetSynchronized(); | 972 resource->SetSynchronized(); |
| 973 } | 973 } |
| 974 } | 974 } |
| 975 } | 975 } |
| 976 | 976 |
| 977 gpu::SyncToken ResourceProvider::GetSyncTokenForResources( |
| 978 const ResourceIdArray& resource_ids) { |
| 979 gpu::SyncToken latest_sync_token; |
| 980 for (ResourceId id : resource_ids) { |
| 981 const gpu::SyncToken& sync_token = GetResource(id)->mailbox().sync_token(); |
| 982 if (sync_token.release_count() > latest_sync_token.release_count()) |
| 983 latest_sync_token = sync_token; |
| 984 } |
| 985 return latest_sync_token; |
| 986 } |
| 987 |
| 977 ResourceProvider::Resource* ResourceProvider::InsertResource( | 988 ResourceProvider::Resource* ResourceProvider::InsertResource( |
| 978 ResourceId id, | 989 ResourceId id, |
| 979 Resource resource) { | 990 Resource resource) { |
| 980 std::pair<ResourceMap::iterator, bool> result = | 991 std::pair<ResourceMap::iterator, bool> result = |
| 981 resources_.insert(ResourceMap::value_type(id, std::move(resource))); | 992 resources_.insert(ResourceMap::value_type(id, std::move(resource))); |
| 982 DCHECK(result.second); | 993 DCHECK(result.second); |
| 983 return &result.first->second; | 994 return &result.first->second; |
| 984 } | 995 } |
| 985 | 996 |
| 986 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { | 997 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 | 2162 |
| 2152 const int kImportance = 2; | 2163 const int kImportance = 2; |
| 2153 pmd->CreateSharedGlobalAllocatorDump(guid); | 2164 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 2154 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2165 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 2155 } | 2166 } |
| 2156 | 2167 |
| 2157 return true; | 2168 return true; |
| 2158 } | 2169 } |
| 2159 | 2170 |
| 2160 } // namespace cc | 2171 } // namespace cc |
| OLD | NEW |