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 "content/browser/renderer_host/accelerated_surface_container_manager_ma
c.h" | 5 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma
c.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/renderer_host/accelerated_surface_container_mac.h" | 8 #include "content/browser/renderer_host/accelerated_surface_container_mac.h" |
9 #include "webkit/plugins/npapi/webplugin.h" | 9 #include "webkit/plugins/npapi/webplugin.h" |
| 10 #include "ui/gfx/rect.h" |
10 | 11 |
11 AcceleratedSurfaceContainerManagerMac::AcceleratedSurfaceContainerManagerMac() | 12 AcceleratedSurfaceContainerManagerMac::AcceleratedSurfaceContainerManagerMac() |
12 : current_id_(0), | 13 : current_id_(0), |
13 root_container_(NULL), | 14 root_container_(NULL), |
14 root_container_handle_(gfx::kNullPluginWindow), | 15 root_container_handle_(gfx::kNullPluginWindow), |
15 gpu_rendering_active_(false) { | 16 gpu_rendering_active_(false) { |
16 } | 17 } |
17 | 18 |
18 AcceleratedSurfaceContainerManagerMac:: | 19 AcceleratedSurfaceContainerManagerMac:: |
19 ~AcceleratedSurfaceContainerManagerMac() {} | 20 ~AcceleratedSurfaceContainerManagerMac() {} |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 139 |
139 void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo( | 140 void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo( |
140 gfx::PluginWindowHandle id, uint64 surface_id) { | 141 gfx::PluginWindowHandle id, uint64 surface_id) { |
141 base::AutoLock lock(lock_); | 142 base::AutoLock lock(lock_); |
142 | 143 |
143 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); | 144 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); |
144 if (container) | 145 if (container) |
145 container->set_was_painted_to(surface_id); | 146 container->set_was_painted_to(surface_id); |
146 } | 147 } |
147 | 148 |
| 149 void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo( |
| 150 gfx::PluginWindowHandle id, |
| 151 uint64 surface_id, |
| 152 const gfx::Rect& update_rect) { |
| 153 base::AutoLock lock(lock_); |
| 154 |
| 155 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); |
| 156 if (container) |
| 157 container->set_was_painted_to(surface_id, update_rect); |
| 158 } |
| 159 |
148 void AcceleratedSurfaceContainerManagerMac::SetRootSurfaceInvalid() { | 160 void AcceleratedSurfaceContainerManagerMac::SetRootSurfaceInvalid() { |
149 base::AutoLock lock(lock_); | 161 base::AutoLock lock(lock_); |
150 if (root_container_) | 162 if (root_container_) |
151 root_container_->set_surface_invalid(); | 163 root_container_->set_surface_invalid(); |
152 } | 164 } |
153 | 165 |
154 bool AcceleratedSurfaceContainerManagerMac::SurfaceShouldBeVisible( | 166 bool AcceleratedSurfaceContainerManagerMac::SurfaceShouldBeVisible( |
155 gfx::PluginWindowHandle id) const { | 167 gfx::PluginWindowHandle id) const { |
156 base::AutoLock lock(lock_); | 168 base::AutoLock lock(lock_); |
157 | 169 |
158 if (IsRootContainer(id) && !gpu_rendering_active_) | 170 if (IsRootContainer(id) && !gpu_rendering_active_) |
159 return false; | 171 return false; |
160 | 172 |
161 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); | 173 AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); |
162 return container && container->ShouldBeVisible(); | 174 return container && container->ShouldBeVisible(); |
163 } | 175 } |
164 | 176 |
165 AcceleratedSurfaceContainerMac* | 177 AcceleratedSurfaceContainerMac* |
166 AcceleratedSurfaceContainerManagerMac::MapIDToContainer( | 178 AcceleratedSurfaceContainerManagerMac::MapIDToContainer( |
167 gfx::PluginWindowHandle id) const { | 179 gfx::PluginWindowHandle id) const { |
168 PluginWindowToContainerMap::const_iterator i = | 180 PluginWindowToContainerMap::const_iterator i = |
169 plugin_window_to_container_map_.find(id); | 181 plugin_window_to_container_map_.find(id); |
170 if (i != plugin_window_to_container_map_.end()) | 182 if (i != plugin_window_to_container_map_.end()) |
171 return i->second; | 183 return i->second; |
172 | 184 |
173 LOG(ERROR) << "Request for plugin container for unknown window id " << id; | 185 LOG(ERROR) << "Request for plugin container for unknown window id " << id; |
174 | 186 |
175 return NULL; | 187 return NULL; |
176 } | 188 } |
OLD | NEW |