| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 | 255 |
| 256 void BrowserGpuMemoryBufferManager::SetDestructionSyncPoint( | 256 void BrowserGpuMemoryBufferManager::SetDestructionSyncPoint( |
| 257 gfx::GpuMemoryBuffer* buffer, | 257 gfx::GpuMemoryBuffer* buffer, |
| 258 uint32 sync_point) { | 258 uint32 sync_point) { |
| 259 static_cast<GpuMemoryBufferImpl*>(buffer) | 259 static_cast<GpuMemoryBufferImpl*>(buffer) |
| 260 ->set_destruction_sync_point(sync_point); | 260 ->set_destruction_sync_point(sync_point); |
| 261 } | 261 } |
| 262 | 262 |
| 263 bool BrowserGpuMemoryBufferManager::OnMemoryDump( | 263 bool BrowserGpuMemoryBufferManager::OnMemoryDump( |
| 264 const base::trace_event::MemoryDumpArgs& args, |
| 264 base::trace_event::ProcessMemoryDump* pmd) { | 265 base::trace_event::ProcessMemoryDump* pmd) { |
| 266 // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested |
| 267 // (crbug.com/499731). |
| 268 |
| 265 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 269 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 266 | 270 |
| 267 for (const auto& client : clients_) { | 271 for (const auto& client : clients_) { |
| 268 int client_id = client.first; | 272 int client_id = client.first; |
| 269 | 273 |
| 270 for (const auto& buffer : client.second) { | 274 for (const auto& buffer : client.second) { |
| 271 if (buffer.second.type == gfx::EMPTY_BUFFER) | 275 if (buffer.second.type == gfx::EMPTY_BUFFER) |
| 272 continue; | 276 continue; |
| 273 | 277 |
| 274 gfx::GpuMemoryBufferId buffer_id = buffer.first; | 278 gfx::GpuMemoryBufferId buffer_id = buffer.first; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 589 } |
| 586 | 590 |
| 587 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id); | 591 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id); |
| 588 if (host) | 592 if (host) |
| 589 host->DestroyGpuMemoryBuffer(id, client_id, sync_point); | 593 host->DestroyGpuMemoryBuffer(id, client_id, sync_point); |
| 590 | 594 |
| 591 buffers.erase(buffer_it); | 595 buffers.erase(buffer_it); |
| 592 } | 596 } |
| 593 | 597 |
| 594 } // namespace content | 598 } // namespace content |
| OLD | NEW |