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

Unified Diff: content/browser/browser_main_loop.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/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 034b3f5a995b4b843ad9994968798486dd122840..38683435ba0f69c1ad548fa34053fe55351b0869 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -4,6 +4,9 @@
#include "content/browser/browser_main_loop.h"
+#include <string>
+#include <vector>
+
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
@@ -40,6 +43,7 @@
#include "content/browser/time_zone_monitor.h"
#include "content/browser/webui/content_web_ui_controller_factory.h"
#include "content/browser/webui/url_data_manager.h"
+#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
#include "content/public/browser/browser_main_parts.h"
#include "content/public/browser/browser_shutdown.h"
#include "content/public/browser/content_browser_client.h"
@@ -430,6 +434,29 @@ void BrowserMainLoop::EarlyInitialization() {
}
#endif // !defined(OS_IOS)
+ std::vector<gfx::GpuMemoryBufferType> supported_types;
+ GpuMemoryBufferImpl::GetSupportedTypes(&supported_types);
+ DCHECK(!supported_types.empty());
+
+ // The default preferred type is always the first one in list.
+ gfx::GpuMemoryBufferType type = supported_types[0];
+
+ if (parsed_command_line_.HasSwitch(switches::kUseGpuMemoryBuffer)) {
+ std::string requested_type_name = parsed_command_line_.GetSwitchValueASCII(
+ switches::kUseGpuMemoryBuffer);
+ gfx::GpuMemoryBufferType requested_type =
+ GpuMemoryBufferImpl::GetNamedType(requested_type_name);
+ if (std::find(supported_types.begin(),
+ supported_types.end(),
+ requested_type) != supported_types.end()) {
+ type = requested_type;
+ } else {
+ LOG(ERROR) << "Requested GPU memory buffer type is not supported.";
+ }
+ }
+
+ GpuMemoryBufferImpl::SetPreferredType(type);
+
if (parts_)
parts_->PostEarlyInitialization();
}

Powered by Google App Engine
This is Rietveld 408576698