| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_GLUE_PLUGINS_MAC_ACCELERATED_SURFACE_CONTAINER_MANAGER_H_ | |
| 6 #define WEBKIT_GLUE_PLUGINS_MAC_ACCELERATED_SURFACE_CONTAINER_MANAGER_H_ | |
| 7 | |
| 8 #include <OpenGL/OpenGL.h> | |
| 9 #include <map> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "app/gfx/native_widget_types.h" | |
| 13 #include "app/surface/transport_dib.h" | |
| 14 #include "base/basictypes.h" | |
| 15 | |
| 16 namespace webkit_glue { | |
| 17 struct WebPluginGeometry; | |
| 18 } | |
| 19 | |
| 20 class MacAcceleratedSurfaceContainer; | |
| 21 | |
| 22 // Helper class that manages the backing store and on-screen rendering | |
| 23 // of instances of the GPU plugin on the Mac. | |
| 24 class MacAcceleratedSurfaceContainerManager { | |
| 25 public: | |
| 26 MacAcceleratedSurfaceContainerManager(); | |
| 27 | |
| 28 // Allocates a new "fake" PluginWindowHandle, which is used as the | |
| 29 // key for the other operations. | |
| 30 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(); | |
| 31 | |
| 32 // Destroys a fake PluginWindowHandle and associated storage. | |
| 33 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); | |
| 34 | |
| 35 // Sets the size and backing store of the plugin instance. There are two | |
| 36 // versions: the IOSurface version is used on systems where the IOSurface | |
| 37 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on | |
| 38 // Mac OS X 10.5 and earlier. | |
| 39 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, | |
| 40 int32 width, | |
| 41 int32 height, | |
| 42 uint64 io_surface_identifier); | |
| 43 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, | |
| 44 int32 width, | |
| 45 int32 height, | |
| 46 TransportDIB::Handle transport_dib); | |
| 47 | |
| 48 // Takes an update from WebKit about a plugin's position and size and moves | |
| 49 // the plugin accordingly. | |
| 50 void MovePluginContainer(const webkit_glue::WebPluginGeometry& move); | |
| 51 | |
| 52 // Draws all of the managed plugin containers into the given OpenGL | |
| 53 // context, which must already be current. | |
| 54 void Draw(CGLContextObj context); | |
| 55 | |
| 56 // Called by the container to enqueue its OpenGL texture objects for | |
| 57 // deletion. | |
| 58 void EnqueueTextureForDeletion(GLuint texture); | |
| 59 | |
| 60 private: | |
| 61 uint32 current_id_; | |
| 62 | |
| 63 // Maps a "fake" plugin window handle to the corresponding container. | |
| 64 MacAcceleratedSurfaceContainer* MapIDToContainer(gfx::PluginWindowHandle id); | |
| 65 | |
| 66 // A map that associates plugin window handles with their containers. | |
| 67 typedef std::map<gfx::PluginWindowHandle, MacAcceleratedSurfaceContainer*> | |
| 68 PluginWindowToContainerMap; | |
| 69 PluginWindowToContainerMap plugin_window_to_container_map_; | |
| 70 | |
| 71 // A list of OpenGL textures waiting to be deleted | |
| 72 std::vector<GLuint> textures_pending_deletion_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(MacAcceleratedSurfaceContainerManager); | |
| 75 }; | |
| 76 | |
| 77 #endif // WEBKIT_GLUE_PLUGINS_MAC_ACCELERATED_SURFACE_CONTAINER_MANAGER_H_ | |
| 78 | |
| OLD | NEW |