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

Side by Side Diff: content/browser/gpu/browser_gpu_memory_buffer_manager.cc

Issue 2971083002: gpu: Reduce direct use of BrowserGpuMemoryBufferManager (Closed)
Patch Set: . Created 3 years, 5 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 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
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).
jbauman 2017/07/06 21:39:18 This comment about unregistration is incorrect now
sadrul 2017/07/06 23:38:18 Hm, you are right. The MemoryDumpManager does not
79 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
80 this, "BrowserGpuMemoryBufferManager",
81 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
74 } 82 }
75 83
76 BrowserGpuMemoryBufferManager::~BrowserGpuMemoryBufferManager() { 84 BrowserGpuMemoryBufferManager::~BrowserGpuMemoryBufferManager() {
77 g_gpu_memory_buffer_manager = nullptr; 85 g_gpu_memory_buffer_manager = nullptr;
78 } 86 }
79 87
80 // static 88 // static
81 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() { 89 BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() {
82 return g_gpu_memory_buffer_manager; 90 return g_gpu_memory_buffer_manager;
83 } 91 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 format(format), 481 format(format),
474 usage(usage), 482 usage(usage),
475 gpu_host_id(gpu_host_id) {} 483 gpu_host_id(gpu_host_id) {}
476 484
477 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = 485 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) =
478 default; 486 default;
479 487
480 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} 488 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {}
481 489
482 } // namespace content 490 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.cc ('k') | content/browser/gpu/compositor_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698