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

Unified Diff: chromecast/browser/cast_content_window.cc

Issue 691023003: Fix an Aura crash several minutes into V2Mirroring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a comment Created 6 years, 2 months 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
« no previous file with comments | « chromecast/browser/cast_browser_main_parts.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_content_window.cc
diff --git a/chromecast/browser/cast_content_window.cc b/chromecast/browser/cast_content_window.cc
index 2e76eafa205cdbb6b5fe2d34aa32624e2b480f06..8cf64b3329566d0e34f1e05f8d5e78cb4bcecaab 100644
--- a/chromecast/browser/cast_content_window.cc
+++ b/chromecast/browser/cast_content_window.cc
@@ -54,7 +54,8 @@ CastContentWindow::CastContentWindow() {}
CastContentWindow::~CastContentWindow() {
#if defined(USE_AURA)
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
}
@@ -63,11 +64,19 @@ scoped_ptr<content::WebContents> CastContentWindow::Create(
content::BrowserContext* browser_context) {
#if defined(USE_AURA)
// 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
// ozone's screen implementation when it is ready.
- aura::TestScreen* screen = aura::TestScreen::Create(initial_size);
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen);
+ gfx::Screen* old_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());
window_tree_host_.reset(
aura::WindowTreeHost::Create(gfx::Rect(initial_size)));
« no previous file with comments | « chromecast/browser/cast_browser_main_parts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698