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

Unified Diff: chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc

Issue 3132038: Mac: Correctly show/hide compositor on navigations. (Closed)
Patch Set: comment Created 10 years, 4 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
Index: chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc
diff --git a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc
index 5a176c605a6d61f3cda2f00355e5feb0a0edceae..8a4649715186849311b181944789c694c2ee5985 100644
--- a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc
+++ b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc
@@ -10,7 +10,9 @@
AcceleratedSurfaceContainerManagerMac::AcceleratedSurfaceContainerManagerMac()
: current_id_(0),
- root_container_(NULL) {
+ root_container_(NULL),
+ root_container_handle_(gfx::kNullPluginWindow),
+ gpu_rendering_active_(false) {
}
gfx::PluginWindowHandle
@@ -23,6 +25,7 @@ AcceleratedSurfaceContainerManagerMac::AllocateFakePluginWindowHandle(
plugin_window_to_container_map_.insert(std::make_pair(res, container));
if (root) {
root_container_ = container;
+ root_container_handle_ = res;
}
return res;
}
@@ -31,17 +34,19 @@ void AcceleratedSurfaceContainerManagerMac::DestroyFakePluginWindowHandle(
gfx::PluginWindowHandle id) {
AcceleratedSurfaceContainerMac* container = MapIDToContainer(id);
if (container) {
- if (container == root_container_)
+ if (container == root_container_) {
root_container_ = NULL;
+ root_container_handle_ = gfx::kNullPluginWindow;
+ }
delete container;
}
plugin_window_to_container_map_.erase(id);
}
bool AcceleratedSurfaceContainerManagerMac::IsRootContainer(
- gfx::PluginWindowHandle id) {
- AcceleratedSurfaceContainerMac* container = MapIDToContainer(id);
- return root_container_ == container;
+ gfx::PluginWindowHandle id) const {
+ return root_container_handle_ != gfx::kNullPluginWindow &&
+ root_container_handle_ == id;
}
void AcceleratedSurfaceContainerManagerMac::SetSizeAndIOSurface(
@@ -73,8 +78,7 @@ void AcceleratedSurfaceContainerManagerMac::SetPluginContainerGeometry(
}
void AcceleratedSurfaceContainerManagerMac::Draw(CGLContextObj context,
- gfx::PluginWindowHandle id,
- bool draw_root_container) {
+ gfx::PluginWindowHandle id) {
glColorMask(true, true, true, true);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -114,6 +118,9 @@ void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo(
bool AcceleratedSurfaceContainerManagerMac::SurfaceShouldBeVisible(
gfx::PluginWindowHandle id) const {
+ if (IsRootContainer(id) && !gpu_rendering_active_)
+ return false;
+
AcceleratedSurfaceContainerMac* container = MapIDToContainer(id);
return container && container->should_be_visible();
}

Powered by Google App Engine
This is Rietveld 408576698