| 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();
|
| }
|
|
|