| 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 #ifndef CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <OpenGL/OpenGL.h> | 9 #include <OpenGL/OpenGL.h> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // contains the compositor's output. | 39 // contains the compositor's output. |
| 40 bool IsRootContainer(gfx::PluginWindowHandle id) const; | 40 bool IsRootContainer(gfx::PluginWindowHandle id) const; |
| 41 | 41 |
| 42 // Returns the handle of the compositor surface, or kNullPluginWindow if no | 42 // Returns the handle of the compositor surface, or kNullPluginWindow if no |
| 43 // compositor surface is active. | 43 // compositor surface is active. |
| 44 gfx::PluginWindowHandle root_container_handle() const { | 44 gfx::PluginWindowHandle root_container_handle() const { |
| 45 return root_container_handle_; | 45 return root_container_handle_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Informs the manager if gpu rendering is active. | 48 // Informs the manager if gpu rendering is active. |
| 49 void set_gpu_rendering_active(bool active) { gpu_rendering_active_ = active; } | 49 void set_gpu_rendering_active(bool active); |
| 50 | 50 |
| 51 // Sets the size and backing store of the plugin instance. There are two | 51 // Sets the size and backing store of the plugin instance. There are two |
| 52 // versions: the IOSurface version is used on systems where the IOSurface | 52 // versions: the IOSurface version is used on systems where the IOSurface |
| 53 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on | 53 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on |
| 54 // Mac OS X 10.5 and earlier. | 54 // Mac OS X 10.5 and earlier. |
| 55 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, | 55 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, |
| 56 int32 width, | 56 int32 width, |
| 57 int32 height, | 57 int32 height, |
| 58 uint64 io_surface_identifier); | 58 uint64 io_surface_identifier); |
| 59 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, | 59 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, |
| 60 int32 width, | 60 int32 width, |
| 61 int32 height, | 61 int32 height, |
| 62 TransportDIB::Handle transport_dib); | 62 TransportDIB::Handle transport_dib); |
| 63 | 63 |
| 64 // Takes an update from WebKit about a plugin's position and size and moves | 64 // Takes an update from WebKit about a plugin's position and size and moves |
| 65 // the plugin accordingly. | 65 // the plugin accordingly. |
| 66 void SetPluginContainerGeometry(const webkit_glue::WebPluginGeometry& move); | 66 void SetPluginContainerGeometry(const webkit_glue::WebPluginGeometry& move); |
| 67 | 67 |
| 68 // Draws the plugin container associated with the given id into the given | 68 // Draws the plugin container associated with the given id into the given |
| 69 // OpenGL context, which must already be current. | 69 // OpenGL context, which must already be current. |
| 70 void Draw(CGLContextObj context, gfx::PluginWindowHandle id); | 70 void Draw(CGLContextObj context, gfx::PluginWindowHandle id); |
| 71 | 71 |
| 72 // Causes the next Draw call on each container to trigger a texture upload. | 72 // Causes the next Draw call on each container to trigger a texture upload. |
| 73 // Should be called any time the drawing context has changed. | 73 // Should be called any time the drawing context has changed. |
| 74 void ForceTextureReload(); | 74 void ForceTextureReload(); |
| 75 | 75 |
| 76 // Notifies a surface that it has been painted to. | 76 // Notifies a surface that it has been painted to. |
| 77 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, uint64 surface_id); | 77 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, uint64 surface_id); |
| 78 | 78 |
| 79 // Notifies the root container that its surface is invalid. |
| 80 void SetRootSurfaceInvalid(); |
| 81 |
| 79 // Returns if a given surface should be shown. | 82 // Returns if a given surface should be shown. |
| 80 bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const; | 83 bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const; |
| 81 private: | 84 private: |
| 82 uint32 current_id_; | 85 uint32 current_id_; |
| 83 | 86 |
| 84 // Maps a "fake" plugin window handle to the corresponding container. | 87 // Maps a "fake" plugin window handle to the corresponding container. |
| 85 AcceleratedSurfaceContainerMac* | 88 AcceleratedSurfaceContainerMac* |
| 86 MapIDToContainer(gfx::PluginWindowHandle id) const; | 89 MapIDToContainer(gfx::PluginWindowHandle id) const; |
| 87 | 90 |
| 88 // A map that associates plugin window handles with their containers. | 91 // A map that associates plugin window handles with their containers. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 110 // Both |plugin_window_to_container_map_| and the | 113 // Both |plugin_window_to_container_map_| and the |
| 111 // AcceleratedSurfaceContainerMac in it are not threadsafe, but accessed from | 114 // AcceleratedSurfaceContainerMac in it are not threadsafe, but accessed from |
| 112 // multiple threads. All these accesses are guarded by this lock. | 115 // multiple threads. All these accesses are guarded by this lock. |
| 113 mutable Lock lock_; | 116 mutable Lock lock_; |
| 114 | 117 |
| 115 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); | 118 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); |
| 116 }; | 119 }; |
| 117 | 120 |
| 118 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ | 121 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ |
| 119 | 122 |
| OLD | NEW |