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