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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "base/trace_event/memory_dump_manager.h" |
15 #include "base/trace_event/process_memory_dump.h" | 16 #include "base/trace_event/process_memory_dump.h" |
16 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "content/browser/gpu/gpu_process_host.h" | 19 #include "content/browser/gpu/gpu_process_host.h" |
19 #include "content/common/child_process_host_impl.h" | 20 #include "content/common/child_process_host_impl.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
22 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" | 23 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" |
23 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 24 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
24 #include "ui/gfx/buffer_format_util.h" | 25 #include "ui/gfx/buffer_format_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 }; | 65 }; |
65 | 66 |
66 BrowserGpuMemoryBufferManager::BrowserGpuMemoryBufferManager( | 67 BrowserGpuMemoryBufferManager::BrowserGpuMemoryBufferManager( |
67 int gpu_client_id, | 68 int gpu_client_id, |
68 uint64_t gpu_client_tracing_id) | 69 uint64_t gpu_client_tracing_id) |
69 : native_configurations_(gpu::GetNativeGpuMemoryBufferConfigurations()), | 70 : native_configurations_(gpu::GetNativeGpuMemoryBufferConfigurations()), |
70 gpu_client_id_(gpu_client_id), | 71 gpu_client_id_(gpu_client_id), |
71 gpu_client_tracing_id_(gpu_client_tracing_id) { | 72 gpu_client_tracing_id_(gpu_client_tracing_id) { |
72 DCHECK(!g_gpu_memory_buffer_manager); | 73 DCHECK(!g_gpu_memory_buffer_manager); |
73 g_gpu_memory_buffer_manager = this; | 74 g_gpu_memory_buffer_manager = this; |
| 75 |
| 76 // Enable the dump provider with IO thread affinity. Note that |
| 77 // unregistration happens on the IO thread (See |
| 78 // BrowserProcessSubThread::IOThreadPreCleanUp). |
| 79 DCHECK(BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 80 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 81 this, "BrowserGpuMemoryBufferManager", |
| 82 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
74 } | 83 } |
75 | 84 |
76 BrowserGpuMemoryBufferManager::~BrowserGpuMemoryBufferManager() { | 85 BrowserGpuMemoryBufferManager::~BrowserGpuMemoryBufferManager() { |
77 g_gpu_memory_buffer_manager = nullptr; | 86 g_gpu_memory_buffer_manager = nullptr; |
78 } | 87 } |
79 | 88 |
80 // static | 89 // static |
81 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() { | 90 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() { |
82 return g_gpu_memory_buffer_manager; | 91 return g_gpu_memory_buffer_manager; |
83 } | 92 } |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 format(format), | 482 format(format), |
474 usage(usage), | 483 usage(usage), |
475 gpu_host_id(gpu_host_id) {} | 484 gpu_host_id(gpu_host_id) {} |
476 | 485 |
477 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = | 486 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = |
478 default; | 487 default; |
479 | 488 |
480 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} | 489 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} |
481 | 490 |
482 } // namespace content | 491 } // namespace content |
OLD | NEW |