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

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

Issue 2560253003: Delay Activation/Draw in smoothness mode.
Patch Set: more unit tests 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
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.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 <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
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::GetSyncTokenForResource(
948 ResourceId resource_id) {
949 Resource* resource = GetResource(resource_id);
950 return resource->mailbox().sync_token();
951 }
952
953 gpu::SyncToken ResourceProvider::GetSyncTokenForResources(
954 const ResourceIdArray& resource_ids) {
955 gpu::SyncToken latest_sync_token;
956 for (ResourceId id : resource_ids) {
957 const gpu::SyncToken& sync_token = GetResource(id)->mailbox().sync_token();
958 if (sync_token.release_count() > latest_sync_token.release_count())
959 latest_sync_token = sync_token;
960 }
961 return latest_sync_token;
962 }
963
947 ResourceProvider::Resource* ResourceProvider::InsertResource( 964 ResourceProvider::Resource* ResourceProvider::InsertResource(
948 ResourceId id, 965 ResourceId id,
949 Resource resource) { 966 Resource resource) {
950 std::pair<ResourceMap::iterator, bool> result = 967 std::pair<ResourceMap::iterator, bool> result =
951 resources_.insert(ResourceMap::value_type(id, std::move(resource))); 968 resources_.insert(ResourceMap::value_type(id, std::move(resource)));
952 DCHECK(result.second); 969 DCHECK(result.second);
953 return &result.first->second; 970 return &result.first->second;
954 } 971 }
955 972
956 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { 973 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) {
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 2081
2065 const int kImportance = 2; 2082 const int kImportance = 2;
2066 pmd->CreateSharedGlobalAllocatorDump(guid); 2083 pmd->CreateSharedGlobalAllocatorDump(guid);
2067 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 2084 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
2068 } 2085 }
2069 2086
2070 return true; 2087 return true;
2071 } 2088 }
2072 2089
2073 } // namespace cc 2090 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698