OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/tiles/gpu_image_decode_controller.h" | 5 #include "cc/tiles/gpu_image_decode_controller.h" |
6 | 6 |
7 #include "base/memory/discardable_memory_allocator.h" | 7 #include "base/memory/discardable_memory_allocator.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/numerics/safe_math.h" | 9 #include "base/numerics/safe_math.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 404 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
405 image_data->size); | 405 image_data->size); |
406 | 406 |
407 // Create a global shred GUID to associate this data with its GPU process | 407 // Create a global shred GUID to associate this data with its GPU process |
408 // counterpart. | 408 // counterpart. |
409 GLuint gl_id = skia::GrBackendObjectToGrGLTextureInfo( | 409 GLuint gl_id = skia::GrBackendObjectToGrGLTextureInfo( |
410 image_data->upload.image->getTextureHandle( | 410 image_data->upload.image->getTextureHandle( |
411 false /* flushPendingGrContextIO */)) | 411 false /* flushPendingGrContextIO */)) |
412 ->fID; | 412 ->fID; |
413 base::trace_event::MemoryAllocatorDumpGuid guid = | 413 base::trace_event::MemoryAllocatorDumpGuid guid = |
414 gfx::GetGLTextureClientGUIDForTracing( | 414 gl::GetGLTextureClientGUIDForTracing( |
415 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id); | 415 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id); |
416 | 416 |
417 // kImportance is somewhat arbitrary - we chose 3 to be higher than the | 417 // kImportance is somewhat arbitrary - we chose 3 to be higher than the |
418 // value used in the GPU process (1), and Skia (2), causing us to appear | 418 // value used in the GPU process (1), and Skia (2), causing us to appear |
419 // as the owner in memory traces. | 419 // as the owner in memory traces. |
420 const int kImportance = 3; | 420 const int kImportance = 3; |
421 pmd->CreateSharedGlobalAllocatorDump(guid); | 421 pmd->CreateSharedGlobalAllocatorDump(guid); |
422 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 422 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
423 } | 423 } |
424 } | 424 } |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 bool GpuImageDecodeController::DiscardableIsLockedForTesting( | 858 bool GpuImageDecodeController::DiscardableIsLockedForTesting( |
859 const DrawImage& image) { | 859 const DrawImage& image) { |
860 base::AutoLock lock(lock_); | 860 base::AutoLock lock(lock_); |
861 auto found = image_data_.Peek(image.image()->uniqueID()); | 861 auto found = image_data_.Peek(image.image()->uniqueID()); |
862 DCHECK(found != image_data_.end()); | 862 DCHECK(found != image_data_.end()); |
863 ImageData* image_data = found->second.get(); | 863 ImageData* image_data = found->second.get(); |
864 return image_data->decode.is_locked; | 864 return image_data->decode.is_locked; |
865 } | 865 } |
866 | 866 |
867 } // namespace cc | 867 } // namespace cc |
OLD | NEW |