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

Side by Side Diff: cc/tiles/gpu_image_decode_controller.cc

Issue 2467973004: Revert of Add BACKGROUND dump mode to various GPU/CC MemoryDumpProviders (Closed)
Patch Set: Created 4 years, 1 month 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_pool.cc ('k') | cc/tiles/software_image_decode_controller.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 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 <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/memory/discardable_memory_allocator.h" 10 #include "base/memory/discardable_memory_allocator.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 DeletePendingImages(); 541 DeletePendingImages();
542 } else { 542 } else {
543 base::AutoLock lock(lock_); 543 base::AutoLock lock(lock_);
544 cached_bytes_limit_ = normal_max_gpu_image_bytes_; 544 cached_bytes_limit_ = normal_max_gpu_image_bytes_;
545 } 545 }
546 } 546 }
547 547
548 bool GpuImageDecodeController::OnMemoryDump( 548 bool GpuImageDecodeController::OnMemoryDump(
549 const base::trace_event::MemoryDumpArgs& args, 549 const base::trace_event::MemoryDumpArgs& args,
550 base::trace_event::ProcessMemoryDump* pmd) { 550 base::trace_event::ProcessMemoryDump* pmd) {
551 using base::trace_event::MemoryAllocatorDump;
552 using base::trace_event::MemoryAllocatorDumpGuid;
553 using base::trace_event::MemoryDumpLevelOfDetail;
554
555 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 551 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
556 "GpuImageDecodeController::OnMemoryDump"); 552 "GpuImageDecodeController::OnMemoryDump");
557
558 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
559 std::string dump_name =
560 base::StringPrintf("cc/image_memory/controller_0x%" PRIXPTR,
561 reinterpret_cast<uintptr_t>(this));
562 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
563 dump->AddScalar(MemoryAllocatorDump::kNameSize,
564 MemoryAllocatorDump::kUnitsBytes, bytes_used_);
565
566 // Early out, no need for more detail in a BACKGROUND dump.
567 return true;
568 }
569
570 for (const auto& image_pair : persistent_cache_) { 553 for (const auto& image_pair : persistent_cache_) {
571 const ImageData* image_data = image_pair.second.get(); 554 const ImageData* image_data = image_pair.second.get();
572 const uint32_t image_id = image_pair.first; 555 const uint32_t image_id = image_pair.first;
573 556
574 // If we have discardable decoded data, dump this here. 557 // If we have discardable decoded data, dump this here.
575 if (image_data->decode.data()) { 558 if (image_data->decode.data()) {
576 std::string discardable_dump_name = base::StringPrintf( 559 std::string discardable_dump_name = base::StringPrintf(
577 "cc/image_memory/controller_0x%" PRIXPTR "/discardable/image_%d", 560 "cc/image_memory/controller_0x%" PRIXPTR "/discardable/image_%d",
578 reinterpret_cast<uintptr_t>(this), image_id); 561 reinterpret_cast<uintptr_t>(this), image_id);
579 MemoryAllocatorDump* dump = 562 base::trace_event::MemoryAllocatorDump* dump =
580 image_data->decode.data()->CreateMemoryAllocatorDump( 563 image_data->decode.data()->CreateMemoryAllocatorDump(
581 discardable_dump_name.c_str(), pmd); 564 discardable_dump_name.c_str(), pmd);
582 // If our image is locked, dump the "locked_size" as an additional 565 // If our image is locked, dump the "locked_size" as an additional column.
583 // column.
584 // This lets us see the amount of discardable which is contributing to 566 // This lets us see the amount of discardable which is contributing to
585 // memory pressure. 567 // memory pressure.
586 if (image_data->decode.is_locked()) { 568 if (image_data->decode.is_locked()) {
587 dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, 569 dump->AddScalar("locked_size",
570 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
588 image_data->size); 571 image_data->size);
589 } 572 }
590 } 573 }
591 574
592 // If we have an uploaded image (that is actually on the GPU, not just a 575 // If we have an uploaded image (that is actually on the GPU, not just a CPU
593 // CPU
594 // wrapper), upload it here. 576 // wrapper), upload it here.
595 if (image_data->upload.image() && 577 if (image_data->upload.image() &&
596 image_data->mode == DecodedDataMode::GPU) { 578 image_data->mode == DecodedDataMode::GPU) {
597 std::string gpu_dump_name = base::StringPrintf( 579 std::string gpu_dump_name = base::StringPrintf(
598 "cc/image_memory/controller_0x%" PRIXPTR "/gpu/image_%d", 580 "cc/image_memory/controller_0x%" PRIXPTR "/gpu/image_%d",
599 reinterpret_cast<uintptr_t>(this), image_id); 581 reinterpret_cast<uintptr_t>(this), image_id);
600 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(gpu_dump_name); 582 base::trace_event::MemoryAllocatorDump* dump =
601 dump->AddScalar(MemoryAllocatorDump::kNameSize, 583 pmd->CreateAllocatorDump(gpu_dump_name);
602 MemoryAllocatorDump::kUnitsBytes, image_data->size); 584 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
585 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
586 image_data->size);
603 587
604 // Create a global shred GUID to associate this data with its GPU 588 // Create a global shred GUID to associate this data with its GPU process
605 // process
606 // counterpart. 589 // counterpart.
607 GLuint gl_id = skia::GrBackendObjectToGrGLTextureInfo( 590 GLuint gl_id = skia::GrBackendObjectToGrGLTextureInfo(
608 image_data->upload.image()->getTextureHandle( 591 image_data->upload.image()->getTextureHandle(
609 false /* flushPendingGrContextIO */)) 592 false /* flushPendingGrContextIO */))
610 ->fID; 593 ->fID;
611 MemoryAllocatorDumpGuid guid = gl::GetGLTextureClientGUIDForTracing( 594 base::trace_event::MemoryAllocatorDumpGuid guid =
612 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id); 595 gl::GetGLTextureClientGUIDForTracing(
596 context_->ContextSupport()->ShareGroupTracingGUID(), gl_id);
613 597
614 // kImportance is somewhat arbitrary - we chose 3 to be higher than the 598 // kImportance is somewhat arbitrary - we chose 3 to be higher than the
615 // value used in the GPU process (1), and Skia (2), causing us to appear 599 // value used in the GPU process (1), and Skia (2), causing us to appear
616 // as the owner in memory traces. 600 // as the owner in memory traces.
617 const int kImportance = 3; 601 const int kImportance = 3;
618 pmd->CreateSharedGlobalAllocatorDump(guid); 602 pmd->CreateSharedGlobalAllocatorDump(guid);
619 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 603 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
620 } 604 }
621 } 605 }
622 606
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 EnsureCapacity(0); 1217 EnsureCapacity(0);
1234 break; 1218 break;
1235 } 1219 }
1236 case base::MemoryState::UNKNOWN: 1220 case base::MemoryState::UNKNOWN:
1237 // NOT_REACHED. 1221 // NOT_REACHED.
1238 break; 1222 break;
1239 } 1223 }
1240 } 1224 }
1241 1225
1242 } // namespace cc 1226 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_pool.cc ('k') | cc/tiles/software_image_decode_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698