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

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

Issue 1151943003: Revert of Add PERSISTENT_MAP usage for GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 "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/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const gfx::Size& size, 92 const gfx::Size& size,
93 gfx::GpuMemoryBuffer::Format format, 93 gfx::GpuMemoryBuffer::Format format,
94 gfx::GpuMemoryBuffer::Usage usage, 94 gfx::GpuMemoryBuffer::Usage usage,
95 int32 surface_id) { 95 int32 surface_id) {
96 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); 96 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO));
97 97
98 // Fallback to shared memory buffer if |format| and |usage| are not supported 98 // Fallback to shared memory buffer if |format| and |usage| are not supported
99 // by factory. 99 // by factory.
100 if (!gpu_memory_buffer_factory_host_->IsGpuMemoryBufferConfigurationSupported( 100 if (!gpu_memory_buffer_factory_host_->IsGpuMemoryBufferConfigurationSupported(
101 format, usage)) { 101 format, usage)) {
102 DCHECK(GpuMemoryBufferImplSharedMemory::IsFormatSupported(format)) 102 DCHECK(GpuMemoryBufferImplSharedMemory::IsFormatSupported(format));
103 << format; 103 DCHECK_EQ(usage, gfx::GpuMemoryBuffer::MAP);
104 DCHECK(GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) << usage;
105 return GpuMemoryBufferImplSharedMemory::Create( 104 return GpuMemoryBufferImplSharedMemory::Create(
106 g_next_gpu_memory_buffer_id.GetNext(), size, format); 105 g_next_gpu_memory_buffer_id.GetNext(), size, format);
107 } 106 }
108 107
109 AllocateGpuMemoryBufferRequest request(size, format, usage, gpu_client_id_, 108 AllocateGpuMemoryBufferRequest request(size, format, usage, gpu_client_id_,
110 surface_id); 109 surface_id);
111 BrowserThread::PostTask( 110 BrowserThread::PostTask(
112 BrowserThread::IO, 111 BrowserThread::IO,
113 FROM_HERE, 112 FROM_HERE,
114 base::Bind(&BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferOnIO, 113 base::Bind(&BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferOnIO,
(...skipping 21 matching lines...) Expand all
136 135
137 BufferMap& buffers = clients_[child_client_id]; 136 BufferMap& buffers = clients_[child_client_id];
138 DCHECK(buffers.find(new_id) == buffers.end()); 137 DCHECK(buffers.find(new_id) == buffers.end());
139 138
140 // Fallback to shared memory buffer if |format| and |usage| are not supported 139 // Fallback to shared memory buffer if |format| and |usage| are not supported
141 // by factory. 140 // by factory.
142 if (!gpu_memory_buffer_factory_host_->IsGpuMemoryBufferConfigurationSupported( 141 if (!gpu_memory_buffer_factory_host_->IsGpuMemoryBufferConfigurationSupported(
143 format, usage)) { 142 format, usage)) {
144 // Early out if we cannot fallback to shared memory buffer. 143 // Early out if we cannot fallback to shared memory buffer.
145 if (!GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) || 144 if (!GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) ||
146 !GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage) || 145 !GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(size, format) ||
147 !GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(size, format)) { 146 usage != gfx::GpuMemoryBuffer::MAP) {
148 callback.Run(gfx::GpuMemoryBufferHandle()); 147 callback.Run(gfx::GpuMemoryBufferHandle());
149 return; 148 return;
150 } 149 }
151 150
152 buffers[new_id] = BufferInfo(size, format, gfx::SHARED_MEMORY_BUFFER); 151 buffers[new_id] = BufferInfo(size, format, gfx::SHARED_MEMORY_BUFFER);
153 callback.Run(GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( 152 callback.Run(GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
154 new_id, size, format, child_process_handle)); 153 new_id, size, format, child_process_handle));
155 return; 154 return;
156 } 155 }
157 156
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 DCHECK_NE(handle.type, gfx::SHARED_MEMORY_BUFFER); 350 DCHECK_NE(handle.type, gfx::SHARED_MEMORY_BUFFER);
352 351
353 // Store the type of this buffer so it can be cleaned up if the child 352 // Store the type of this buffer so it can be cleaned up if the child
354 // process is removed. 353 // process is removed.
355 buffer_it->second.type = handle.type; 354 buffer_it->second.type = handle.type;
356 355
357 callback.Run(handle); 356 callback.Run(handle);
358 } 357 }
359 358
360 } // namespace content 359 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698