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

Unified Diff: content/browser/gpu/browser_gpu_channel_host_factory.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: fix unit test failures on macosx 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/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 a1d9da190a8cbb0318b789f63f0827e2367eb061..a3f7fef4c3ed1f8a4121835f1d7cf7fa3015854a 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -4,6 +4,8 @@
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
+#include <set>
+
#include "base/bind.h"
#include "base/debug/trace_event.h"
#include "base/synchronization/waitable_event.h"
@@ -36,6 +38,11 @@
#endif
namespace content {
+namespace {
+
+base::LazyInstance<std::set<gfx::GpuMemoryBuffer::Usage>>
+ g_enabled_gpu_memory_buffer_usages;
+}
BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL;
@@ -232,6 +239,18 @@ void BrowserGpuChannelHostFactory::Terminate() {
instance_ = NULL;
}
+// static
+void BrowserGpuChannelHostFactory::EnableGpuMemoryBufferFactoryUsage(
+ gfx::GpuMemoryBuffer::Usage usage) {
+ g_enabled_gpu_memory_buffer_usages.Get().insert(usage);
+}
+
+// static
+bool BrowserGpuChannelHostFactory::IsGpuMemoryBufferFactoryUsageEnabled(
+ gfx::GpuMemoryBuffer::Usage usage) {
+ return g_enabled_gpu_memory_buffer_usages.Get().count(usage) != 0;
+}
+
BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory()
: gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
shutdown_event_(new base::WaitableEvent(true, false)),
@@ -428,6 +447,10 @@ void BrowserGpuChannelHostFactory::SetHandlerForControlMessages(
bool BrowserGpuChannelHostFactory::IsGpuMemoryBufferConfigurationSupported(
gfx::GpuMemoryBuffer::Format format,
gfx::GpuMemoryBuffer::Usage usage) {
+ // Return early if usage is not enabled.
+ if (IsGpuMemoryBufferFactoryUsageEnabled(usage))
+ return false;
+
// Preferred type is always used by factory.
std::vector<gfx::GpuMemoryBufferType> supported_types;
GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);

Powered by Google App Engine
This is Rietveld 408576698