| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/renderer_host/accelerated_surface_container_manager_mac
.h" | 5 #include "chrome/browser/renderer_host/accelerated_surface_container_manager_mac
.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/renderer_host/accelerated_surface_container_mac.h" | 8 #include "chrome/browser/renderer_host/accelerated_surface_container_mac.h" |
| 9 #include "webkit/glue/plugins/webplugin.h" | 9 #include "webkit/glue/plugins/webplugin.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 plugin_window_to_container_map_.erase(id); | 47 plugin_window_to_container_map_.erase(id); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool AcceleratedSurfaceContainerManagerMac::IsRootContainer( | 50 bool AcceleratedSurfaceContainerManagerMac::IsRootContainer( |
| 51 gfx::PluginWindowHandle id) const { | 51 gfx::PluginWindowHandle id) const { |
| 52 return root_container_handle_ != gfx::kNullPluginWindow && | 52 return root_container_handle_ != gfx::kNullPluginWindow && |
| 53 root_container_handle_ == id; | 53 root_container_handle_ == id; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void AcceleratedSurfaceContainerManagerMac:: |
| 57 set_gpu_rendering_active(bool active) { |
| 58 if (gpu_rendering_active_ && !active) |
| 59 SetRootSurfaceInvalid(); |
| 60 gpu_rendering_active_ = active; |
| 61 } |
| 62 |
| 56 void AcceleratedSurfaceContainerManagerMac::SetSizeAndIOSurface( | 63 void AcceleratedSurfaceContainerManagerMac::SetSizeAndIOSurface( |
| 57 gfx::PluginWindowHandle id, | 64 gfx::PluginWindowHandle id, |
| 58 int32 width, | 65 int32 width, |
| 59 int32 height, | 66 int32 height, |
| 60 uint64 io_surface_identifier) { | 67 uint64 io_surface_identifier) { |
| 61 AutoLock lock(lock_); | 68 AutoLock lock(lock_); |
| 62 | 69 |
| 63 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); | 70 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); |
| 64 if (container) { | 71 if (container) { |
| 65 container->SetSizeAndIOSurface(width, height, io_surface_identifier); | 72 container->SetSizeAndIOSurface(width, height, io_surface_identifier); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 132 |
| 126 void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo( | 133 void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo( |
| 127 gfx::PluginWindowHandle id, uint64 surface_id) { | 134 gfx::PluginWindowHandle id, uint64 surface_id) { |
| 128 AutoLock lock(lock_); | 135 AutoLock lock(lock_); |
| 129 | 136 |
| 130 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); | 137 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); |
| 131 if (container) | 138 if (container) |
| 132 container->set_was_painted_to(surface_id); | 139 container->set_was_painted_to(surface_id); |
| 133 } | 140 } |
| 134 | 141 |
| 142 void AcceleratedSurfaceContainerManagerMac::SetRootSurfaceInvalid() { |
| 143 AutoLock lock(lock_); |
| 144 if (root_container_) |
| 145 root_container_->set_surface_invalid(); |
| 146 } |
| 147 |
| 135 bool AcceleratedSurfaceContainerManagerMac::SurfaceShouldBeVisible( | 148 bool AcceleratedSurfaceContainerManagerMac::SurfaceShouldBeVisible( |
| 136 gfx::PluginWindowHandle id) const { | 149 gfx::PluginWindowHandle id) const { |
| 137 AutoLock lock(lock_); | 150 AutoLock lock(lock_); |
| 138 | 151 |
| 139 if (IsRootContainer(id) && !gpu_rendering_active_) | 152 if (IsRootContainer(id) && !gpu_rendering_active_) |
| 140 return false; | 153 return false; |
| 141 | 154 |
| 142 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); | 155 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); |
| 143 return container && container->should_be_visible(); | 156 return container && container->should_be_visible(); |
| 144 } | 157 } |
| 145 | 158 |
| 146 AcceleratedSurfaceContainerMac* | 159 AcceleratedSurfaceContainerMac* |
| 147 AcceleratedSurfaceContainerManagerMac::MapIDToContainer( | 160 AcceleratedSurfaceContainerManagerMac::MapIDToContainer( |
| 148 gfx::PluginWindowHandle id) const { | 161 gfx::PluginWindowHandle id) const { |
| 149 PluginWindowToContainerMap::const_iterator i = | 162 PluginWindowToContainerMap::const_iterator i = |
| 150 plugin_window_to_container_map_.find(id); | 163 plugin_window_to_container_map_.find(id); |
| 151 if (i != plugin_window_to_container_map_.end()) | 164 if (i != plugin_window_to_container_map_.end()) |
| 152 return i->second; | 165 return i->second; |
| 153 | 166 |
| 154 LOG(ERROR) << "Request for plugin container for unknown window id " << id; | 167 LOG(ERROR) << "Request for plugin container for unknown window id " << id; |
| 155 | 168 |
| 156 return NULL; | 169 return NULL; |
| 157 } | 170 } |
| OLD | NEW |