Skip to content

Instantly share code, notes, and snippets.

@tiagovignatti
Created December 3, 2013 19:52
Show Gist options
  • Save tiagovignatti/7776322 to your computer and use it in GitHub Desktop.
Save tiagovignatti/7776322 to your computer and use it in GitHub Desktop.
circumvent the --single-process issue
tiago@fisu:~/git/chromium/src/ozone$ git diff
diff --git a/impl/ozone_display.cc b/impl/ozone_display.cc
index 7a07959..7697323 100644
--- a/impl/ozone_display.cc
+++ b/impl/ozone_display.cc
@@ -20,6 +20,10 @@
#include "base/native_library.h"
#include "content/child/child_process.h"
+#include "base/command_line.h"
+#include "content/public/common/content_switches.h"
+#include "ui/gl/gl_surface.h"
+
namespace ozonewayland {
OzoneDisplay* OzoneDisplay::instance_ = NULL;
@@ -80,6 +84,9 @@ gfx::SurfaceFactoryOzone::HardwareState OzoneDisplay::InitializeHardware()
if (initialized_state_ != gfx::SurfaceFactoryOzone::INITIALIZED)
LOG(ERROR) << "OzoneDisplay failed to initialize hardware";
+ else if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) ||
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU))
+ ; // intentional
else if (!content::ChildProcess::current()) {
// In the multi-processed mode, DisplayChannel(in Gpu process side) is in
// charge of pre-initializing the IPC channel with DisplayChannelHost. At
@@ -107,7 +114,17 @@ void OzoneDisplay::ShutdownHardware()
gfx::AcceleratedWidget OzoneDisplay::GetAcceleratedWidget()
{
static int opaque_handle = 0;
- // Ensure dispatcher is initialized.
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) ||
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) {
+ // For single process and in-process GPU mode, we need to load and
+ // initialize the GL implementation and locate the GL entry points here.
+ if (!gfx::GLSurface::InitializeOneOff()) {
+ VLOG(1) << "gfx::GLSurface::InitializeOneOff()";
+ }
+ }
+
+ // Ensure dispatcher is initialized.
if (!dispatcher_)
InitializeDispatcher();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment