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

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

Issue 2440093003: WIP GPU scheduler + delayed activation / tile draw
Patch Set: SignalSyncToken -> IsFenceSyncReleased 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/test/fake_raster_buffer_provider.h » ('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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 use_texture_usage_hint_(false), 412 use_texture_usage_hint_(false),
413 use_compressed_texture_etc1_(false), 413 use_compressed_texture_etc1_(false),
414 yuv_resource_format_(LUMINANCE_8), 414 yuv_resource_format_(LUMINANCE_8),
415 max_texture_size_(0), 415 max_texture_size_(0),
416 best_texture_format_(RGBA_8888), 416 best_texture_format_(RGBA_8888),
417 best_render_buffer_format_(RGBA_8888), 417 best_render_buffer_format_(RGBA_8888),
418 enable_color_correct_rendering_(enable_color_correct_rendering), 418 enable_color_correct_rendering_(enable_color_correct_rendering),
419 id_allocation_chunk_size_(id_allocation_chunk_size), 419 id_allocation_chunk_size_(id_allocation_chunk_size),
420 use_sync_query_(false), 420 use_sync_query_(false),
421 buffer_to_texture_target_map_(buffer_to_texture_target_map), 421 buffer_to_texture_target_map_(buffer_to_texture_target_map),
422 tracing_id_(g_next_resource_provider_tracing_id.GetNext()) { 422 tracing_id_(g_next_resource_provider_tracing_id.GetNext()),
423 weak_ptr_factory_(this) {
423 DCHECK(id_allocation_chunk_size_); 424 DCHECK(id_allocation_chunk_size_);
424 DCHECK(thread_checker_.CalledOnValidThread()); 425 DCHECK(thread_checker_.CalledOnValidThread());
425 426
426 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). 427 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
427 // Don't register a dump provider in these cases. 428 // Don't register a dump provider in these cases.
428 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 429 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
429 if (base::ThreadTaskRunnerHandle::IsSet()) { 430 if (base::ThreadTaskRunnerHandle::IsSet()) {
430 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 431 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
431 this, "cc::ResourceProvider", base::ThreadTaskRunnerHandle::Get()); 432 this, "cc::ResourceProvider", base::ThreadTaskRunnerHandle::Get());
432 } 433 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 938 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
938 created_sync_token = true; 939 created_sync_token = true;
939 } 940 }
940 941
941 resource->UpdateSyncToken(sync_token); 942 resource->UpdateSyncToken(sync_token);
942 resource->SetSynchronized(); 943 resource->SetSynchronized();
943 } 944 }
944 } 945 }
945 } 946 }
946 947
948 gpu::SyncToken ResourceProvider::GetSyncTokenForResource(
949 ResourceId resource_id) {
950 Resource* resource = GetResource(resource_id);
951 return resource->mailbox().sync_token();
952 }
953
954 gpu::SyncToken ResourceProvider::GetSyncTokenForResources(
955 const ResourceIdArray& resource_ids) {
956 gpu::SyncToken sync_token;
957 for (ResourceId id : resource_ids) {
958 Resource* resource = GetResource(id);
959 if (resource->mailbox().sync_token().release_count() >=
960 sync_token.release_count()) {
961 sync_token = resource->mailbox().sync_token();
962 }
963 }
964 return sync_token;
965 }
966
947 ResourceProvider::Resource* ResourceProvider::InsertResource( 967 ResourceProvider::Resource* ResourceProvider::InsertResource(
948 ResourceId id, 968 ResourceId id,
949 Resource resource) { 969 Resource resource) {
950 std::pair<ResourceMap::iterator, bool> result = 970 std::pair<ResourceMap::iterator, bool> result =
951 resources_.insert(ResourceMap::value_type(id, std::move(resource))); 971 resources_.insert(ResourceMap::value_type(id, std::move(resource)));
952 DCHECK(result.second); 972 DCHECK(result.second);
953 return &result.first->second; 973 return &result.first->second;
954 } 974 }
955 975
956 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { 976 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) {
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 2084
2065 const int kImportance = 2; 2085 const int kImportance = 2;
2066 pmd->CreateSharedGlobalAllocatorDump(guid); 2086 pmd->CreateSharedGlobalAllocatorDump(guid);
2067 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 2087 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
2068 } 2088 }
2069 2089
2070 return true; 2090 return true;
2071 } 2091 }
2072 2092
2073 } // namespace cc 2093 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/test/fake_raster_buffer_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698