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

Unified Diff: content/browser/gpu/browser_gpu_channel_host_factory.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 side-by-side diff with in-line comments
Download patch
Index: content/browser/gpu/browser_gpu_channel_host_factory.cc
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index 4019ccb8fc7125d59ca0d12cfd9e9b961c4b142f..205542cdc81e918839841fbbeb55d99e16c6cadd 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -43,37 +43,7 @@
base::LazyInstance<std::set<gfx::GpuMemoryBuffer::Usage>>
g_enabled_gpu_memory_buffer_usages;
-
-bool IsGpuMemoryBufferFactoryConfigurationSupported(
- gfx::GpuMemoryBuffer::Format format,
- gfx::GpuMemoryBuffer::Usage usage,
- gfx::GpuMemoryBufferType type) {
- switch (type) {
- case gfx::SHARED_MEMORY_BUFFER:
- // Shared memory buffers must be created in-process.
- return false;
-#if defined(OS_MACOSX)
- case gfx::IO_SURFACE_BUFFER:
- return GpuMemoryBufferFactoryIOSurface::
- IsGpuMemoryBufferConfigurationSupported(format, usage);
-#endif
-#if defined(OS_ANDROID)
- case gfx::SURFACE_TEXTURE_BUFFER:
- return GpuMemoryBufferFactorySurfaceTexture::
- IsGpuMemoryBufferConfigurationSupported(format, usage);
-#endif
-#if defined(USE_OZONE)
- case gfx::OZONE_NATIVE_BUFFER:
- return GpuMemoryBufferFactoryOzoneNativeBuffer::
- IsGpuMemoryBufferConfigurationSupported(format, usage);
-#endif
- default:
- NOTREACHED();
- return false;
- }
-}
-
-} // namespace
+}
BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL;
@@ -284,22 +254,16 @@
}
// static
-uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget(
- gfx::GpuMemoryBuffer::Format format,
- gfx::GpuMemoryBuffer::Usage usage) {
- if (!IsGpuMemoryBufferFactoryUsageEnabled(usage))
+uint32 BrowserGpuChannelHostFactory::GetImageTextureTarget() {
+ if (!IsGpuMemoryBufferFactoryUsageEnabled(gfx::GpuMemoryBuffer::MAP))
return GL_TEXTURE_2D;
std::vector<gfx::GpuMemoryBufferType> supported_types;
GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
DCHECK(!supported_types.empty());
- // The GPU service will always use the preferred type, if the |format| and
- // |usage| allows.
+ // The GPU service will always use the preferred type.
gfx::GpuMemoryBufferType type = supported_types[0];
-
- if (!IsGpuMemoryBufferFactoryConfigurationSupported(format, usage, type))
- return GL_TEXTURE_2D;
switch (type) {
case gfx::SURFACE_TEXTURE_BUFFER:
@@ -507,15 +471,33 @@
if (!IsGpuMemoryBufferFactoryUsageEnabled(usage))
return false;
+ // Preferred type is always used by factory.
std::vector<gfx::GpuMemoryBufferType> supported_types;
GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
DCHECK(!supported_types.empty());
-
- // The GPU service will always use the preferred type, if the |format| and
- // |usage| allows.
- gfx::GpuMemoryBufferType type = supported_types[0];
-
- return IsGpuMemoryBufferFactoryConfigurationSupported(format, usage, type);
+ switch (supported_types[0]) {
+ case gfx::SHARED_MEMORY_BUFFER:
+ // Shared memory buffers must be created in-process.
+ return false;
+#if defined(OS_MACOSX)
+ case gfx::IO_SURFACE_BUFFER:
+ return GpuMemoryBufferFactoryIOSurface::
+ IsGpuMemoryBufferConfigurationSupported(format, usage);
+#endif
+#if defined(OS_ANDROID)
+ case gfx::SURFACE_TEXTURE_BUFFER:
+ return GpuMemoryBufferFactorySurfaceTexture::
+ IsGpuMemoryBufferConfigurationSupported(format, usage);
+#endif
+#if defined(USE_OZONE)
+ case gfx::OZONE_NATIVE_BUFFER:
+ return GpuMemoryBufferFactoryOzoneNativeBuffer::
+ IsGpuMemoryBufferConfigurationSupported(format, usage);
+#endif
+ default:
+ NOTREACHED();
+ return false;
+ }
}
void BrowserGpuChannelHostFactory::CreateGpuMemoryBuffer(
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.h ('k') | content/browser/gpu/browser_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698