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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl.cc

Issue 699073004: content: Add command line flag for native GPU memory buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gpu-memory-buffer-impl-unittests
Patch Set: rebase and use correct texture target Created 6 years, 1 month 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/common/gpu/client/gpu_memory_buffer_impl.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.cc b/content/common/gpu/client/gpu_memory_buffer_impl.cc
index 972ffa65e3a5ae1d7a89d147ac2ff575c32320a4..48f35a8e9728b562d0b75abd6c533b91d7b1743d 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl.cc
@@ -11,6 +11,16 @@
namespace content {
namespace {
+const struct TypeNamePair {
+ gfx::GpuMemoryBufferType type;
+ const char* name;
+} kTypeNamePairs[] = {
+ { gfx::SHARED_MEMORY_BUFFER, "shmem" },
+ { gfx::IO_SURFACE_BUFFER, "iosurface" },
+ { gfx::SURFACE_TEXTURE_BUFFER, "surfacetexture" },
+ { gfx::OZONE_NATIVE_BUFFER, "ozone" }
+};
+
gfx::GpuMemoryBufferType g_preferred_type = gfx::EMPTY_BUFFER;
struct DefaultPreferredType {
@@ -44,6 +54,27 @@ GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
}
// static
+gfx::GpuMemoryBufferType GpuMemoryBufferImpl::GetNamedType(
+ const std::string& name) {
+ for (size_t i = 0; i < arraysize(kTypeNamePairs); ++i) {
piman 2014/11/19 02:39:40 nit: range for?
+ if (name == kTypeNamePairs[i].name)
+ return kTypeNamePairs[i].type;
+ }
+
+ return gfx::EMPTY_BUFFER;
+}
+
+// static
+const char* GpuMemoryBufferImpl::GetTypeName(gfx::GpuMemoryBufferType type) {
+ for (size_t i = 0; i < arraysize(kTypeNamePairs); ++i) {
piman 2014/11/19 02:39:40 nit: range for?
+ if (type == kTypeNamePairs[i].type)
+ return kTypeNamePairs[i].name;
+ }
+
+ return "unknown";
+}
+
+// static
void GpuMemoryBufferImpl::SetPreferredType(gfx::GpuMemoryBufferType type) {
// EMPTY_BUFFER is a reserved value and not a valid preferred type.
DCHECK_NE(gfx::EMPTY_BUFFER, type);

Powered by Google App Engine
This is Rietveld 408576698