Commit 7c054678 authored by gusfernandez's avatar gusfernandez Committed by Commit bot

Fix an Aura crash several minutes into V2Mirroring

Since we deleted the gfx::screen each time we closed an app,
A query to the screen size during metrics gathering was causing
a check failure.

BUG=

Review URL: https://codereview.chromium.org/691023003

Cr-Commit-Position: refs/heads/master@{#302194}
parent e6adf145
...@@ -52,6 +52,11 @@ DefaultCommandLineSwitch g_default_switches[] = { ...@@ -52,6 +52,11 @@ DefaultCommandLineSwitch g_default_switches[] = {
{ switches::kDisablePlugins, "" }, { switches::kDisablePlugins, "" },
// Always enable HTMLMediaElement logs. // Always enable HTMLMediaElement logs.
{ switches::kBlinkPlatformLogChannels, "Media"}, { switches::kBlinkPlatformLogChannels, "Media"},
#if defined(OS_LINUX) && defined(ARCH_CPU_X86_FAMILY)
// This is needed for now to enable the egltest Ozone platform to work with
// current Linux/NVidia OpenGL drivers.
{ switches::kIgnoreGpuBlacklist, ""},
#endif
{ NULL, NULL }, // Termination { NULL, NULL }, // Termination
}; };
......
...@@ -54,7 +54,8 @@ CastContentWindow::CastContentWindow() {} ...@@ -54,7 +54,8 @@ CastContentWindow::CastContentWindow() {}
CastContentWindow::~CastContentWindow() { CastContentWindow::~CastContentWindow() {
#if defined(USE_AURA) #if defined(USE_AURA)
window_tree_host_.reset(); window_tree_host_.reset();
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); // We don't delete the screen here to avoid a CHECK failure when
// the screen size is queried periodically for metric gathering. b/18101124
#endif #endif
} }
...@@ -63,11 +64,19 @@ scoped_ptr<content::WebContents> CastContentWindow::Create( ...@@ -63,11 +64,19 @@ scoped_ptr<content::WebContents> CastContentWindow::Create(
content::BrowserContext* browser_context) { content::BrowserContext* browser_context) {
#if defined(USE_AURA) #if defined(USE_AURA)
// Aura initialization // Aura initialization
// TODO(lcwu): We only need a minimal implementation of gfx::screen // TODO(lcwu): We only need a minimal implementation of gfx::Screen
// and aura's TestScreen will do for us now. We should change to use // and aura's TestScreen will do for us now. We should change to use
// ozone's screen implementation when it is ready. // ozone's screen implementation when it is ready.
aura::TestScreen* screen = aura::TestScreen::Create(initial_size); gfx::Screen* old_screen =
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen); gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE);
if (!old_screen || old_screen->GetPrimaryDisplay().size() != initial_size) {
gfx::Screen* new_screen = aura::TestScreen::Create(initial_size);
DCHECK(new_screen) << "New screen not created.";
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, new_screen);
if (old_screen) {
delete old_screen;
}
}
CHECK(aura::Env::GetInstance()); CHECK(aura::Env::GetInstance());
window_tree_host_.reset( window_tree_host_.reset(
aura::WindowTreeHost::Create(gfx::Rect(initial_size))); aura::WindowTreeHost::Create(gfx::Rect(initial_size)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment