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

Unified Diff: content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc

Issue 1128113011: ozone: Introduce ClientPixmap and ClientPixmapFactory for non-GPU processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix extensions_unittests Created 5 years, 4 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
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/renderer/renderer_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc b/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
index a651f51c134712d6ebb7b0fa616a4567bb06ba73..8435d69e54081c4c85919b761b2623f27d5fa0f1 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
@@ -5,15 +5,28 @@
#include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h"
#include "ui/gl/gl_image_ozone_native_pixmap.h"
+#include "ui/ozone/public/client_native_pixmap_factory.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
namespace content {
namespace {
-const GpuMemoryBufferFactory::Configuration kSupportedConfigurations[] = {
- {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::SCANOUT},
- {gfx::BufferFormat::RGBX_8888, gfx::BufferUsage::SCANOUT}};
+void GetSupportedConfigurations(
+ std::vector<GpuMemoryBufferFactory::Configuration>* configurations) {
+ if (!ui::ClientNativePixmapFactory::GetInstance()) {
+ // unittests don't have to set ClientNativePixmapFactory.
+ return;
+ }
+ std::vector<ui::ClientNativePixmapFactory::Configuration>
+ native_pixmap_configurations =
+ ui::ClientNativePixmapFactory::GetInstance()
+ ->GetSupportedConfigurations();
+ for (auto& native_pixmap_configuration : native_pixmap_configurations) {
+ configurations->push_back({native_pixmap_configuration.format,
+ native_pixmap_configuration.usage});
+ }
+}
} // namespace
@@ -27,7 +40,9 @@ GpuMemoryBufferFactoryOzoneNativePixmap::
bool GpuMemoryBufferFactoryOzoneNativePixmap::
IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format,
gfx::BufferUsage usage) {
- for (auto& configuration : kSupportedConfigurations) {
+ std::vector<Configuration> configurations;
+ GetSupportedConfigurations(&configurations);
+ for (auto& configuration : configurations) {
if (configuration.format == format && configuration.usage == usage)
return true;
}
@@ -38,14 +53,7 @@ bool GpuMemoryBufferFactoryOzoneNativePixmap::
void GpuMemoryBufferFactoryOzoneNativePixmap::
GetSupportedGpuMemoryBufferConfigurations(
std::vector<Configuration>* configurations) {
- if (!ui::OzonePlatform::GetInstance()
- ->GetSurfaceFactoryOzone()
- ->CanCreateNativePixmap(gfx::BufferUsage::SCANOUT))
- return;
-
- configurations->assign(
- kSupportedConfigurations,
- kSupportedConfigurations + arraysize(kSupportedConfigurations));
+ GetSupportedConfigurations(configurations);
}
gfx::GpuMemoryBufferHandle
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/renderer/renderer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698