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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2382573002: Add BACKGROUND dump mode to various GPU/CC MemoryDumpProviders (Closed)
Patch Set: rebase Created 4 years, 2 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // |aggressively_free_resources_| is true. 427 // |aggressively_free_resources_| is true.
428 Flush(); 428 Flush();
429 } else { 429 } else {
430 ShallowFlushCHROMIUM(); 430 ShallowFlushCHROMIUM();
431 } 431 }
432 } 432 }
433 433
434 bool GLES2Implementation::OnMemoryDump( 434 bool GLES2Implementation::OnMemoryDump(
435 const base::trace_event::MemoryDumpArgs& args, 435 const base::trace_event::MemoryDumpArgs& args,
436 base::trace_event::ProcessMemoryDump* pmd) { 436 base::trace_event::ProcessMemoryDump* pmd) {
437 using base::trace_event::MemoryAllocatorDump;
438 using base::trace_event::MemoryDumpLevelOfDetail;
439
437 if (!transfer_buffer_->HaveBuffer()) 440 if (!transfer_buffer_->HaveBuffer())
438 return true; 441 return true;
439 442
440 const uint64_t tracing_process_id = 443 const uint64_t tracing_process_id =
441 base::trace_event::MemoryDumpManager::GetInstance() 444 base::trace_event::MemoryDumpManager::GetInstance()
442 ->GetTracingProcessId(); 445 ->GetTracingProcessId();
443 446
444 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( 447 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf(
445 base::StringPrintf("gpu/transfer_buffer_memory/buffer_%d", 448 "gpu/transfer_buffer_memory/buffer_%d", transfer_buffer_->GetShmId()));
446 transfer_buffer_->GetShmId())); 449 dump->AddScalar(MemoryAllocatorDump::kNameSize,
447 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 450 MemoryAllocatorDump::kUnitsBytes,
448 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
449 transfer_buffer_->GetSize()); 451 transfer_buffer_->GetSize());
450 dump->AddScalar("free_size", 452
451 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 453 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) {
452 transfer_buffer_->GetFreeSize()); 454 dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes,
453 auto guid = 455 transfer_buffer_->GetFreeSize());
454 GetBufferGUIDForTracing(tracing_process_id, transfer_buffer_->GetShmId()); 456 auto guid = GetBufferGUIDForTracing(tracing_process_id,
455 const int kImportance = 2; 457 transfer_buffer_->GetShmId());
456 pmd->CreateSharedGlobalAllocatorDump(guid); 458 const int kImportance = 2;
457 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 459 pmd->CreateSharedGlobalAllocatorDump(guid);
460 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
461 }
458 462
459 return true; 463 return true;
460 } 464 }
461 465
462 void GLES2Implementation::WaitForCmd() { 466 void GLES2Implementation::WaitForCmd() {
463 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); 467 TRACE_EVENT0("gpu", "GLES2::WaitForCmd");
464 helper_->CommandBufferHelper::Finish(); 468 helper_->CommandBufferHelper::Finish();
465 } 469 }
466 470
467 bool GLES2Implementation::IsExtensionAvailable(const char* ext) { 471 bool GLES2Implementation::IsExtensionAvailable(const char* ext) {
(...skipping 6485 matching lines...) Expand 10 before | Expand all | Expand 10 after
6953 cached_extensions_.clear(); 6957 cached_extensions_.clear();
6954 } 6958 }
6955 6959
6956 // Include the auto-generated part of this file. We split this because it means 6960 // Include the auto-generated part of this file. We split this because it means
6957 // we can easily edit the non-auto generated parts right here in this file 6961 // we can easily edit the non-auto generated parts right here in this file
6958 // instead of having to edit some template or the code generator. 6962 // instead of having to edit some template or the code generator.
6959 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 6963 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
6960 6964
6961 } // namespace gles2 6965 } // namespace gles2
6962 } // namespace gpu 6966 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.cc ('k') | gpu/command_buffer/client/mapped_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698