| 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 937 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 938 created_sync_token = true; | 938 created_sync_token = true; |
| 939 } | 939 } |
| 940 | 940 |
| 941 resource->UpdateSyncToken(sync_token); | 941 resource->UpdateSyncToken(sync_token); |
| 942 resource->SetSynchronized(); | 942 resource->SetSynchronized(); |
| 943 } | 943 } |
| 944 } | 944 } |
| 945 } | 945 } |
| 946 | 946 |
| 947 gpu::SyncToken ResourceProvider::GetSyncTokenForResources( |
| 948 const ResourceIdArray& resource_ids) { |
| 949 gpu::SyncToken latest_sync_token; |
| 950 for (ResourceId id : resource_ids) { |
| 951 const gpu::SyncToken& sync_token = GetResource(id)->mailbox().sync_token(); |
| 952 if (sync_token.release_count() > latest_sync_token.release_count()) |
| 953 latest_sync_token = sync_token; |
| 954 } |
| 955 return latest_sync_token; |
| 956 } |
| 957 |
| 947 ResourceProvider::Resource* ResourceProvider::InsertResource( | 958 ResourceProvider::Resource* ResourceProvider::InsertResource( |
| 948 ResourceId id, | 959 ResourceId id, |
| 949 Resource resource) { | 960 Resource resource) { |
| 950 std::pair<ResourceMap::iterator, bool> result = | 961 std::pair<ResourceMap::iterator, bool> result = |
| 951 resources_.insert(ResourceMap::value_type(id, std::move(resource))); | 962 resources_.insert(ResourceMap::value_type(id, std::move(resource))); |
| 952 DCHECK(result.second); | 963 DCHECK(result.second); |
| 953 return &result.first->second; | 964 return &result.first->second; |
| 954 } | 965 } |
| 955 | 966 |
| 956 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { | 967 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 | 2075 |
| 2065 const int kImportance = 2; | 2076 const int kImportance = 2; |
| 2066 pmd->CreateSharedGlobalAllocatorDump(guid); | 2077 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 2067 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2078 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 2068 } | 2079 } |
| 2069 | 2080 |
| 2070 return true; | 2081 return true; |
| 2071 } | 2082 } |
| 2072 | 2083 |
| 2073 } // namespace cc | 2084 } // namespace cc |
| OLD | NEW |