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_GPU_PLUGIN_CONTAINER_MANAGER_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_MAC_GPU_PLUGIN_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 "base/basictypes.h" |
| 14 |
| 15 namespace webkit_glue { |
| 16 struct WebPluginGeometry; |
| 17 } |
| 18 |
| 19 class MacGPUPluginContainer; |
| 20 |
| 21 // Helper class that manages the backing store and on-screen rendering |
| 22 // of instances of the GPU plugin on the Mac. |
| 23 class MacGPUPluginContainerManager { |
| 24 public: |
| 25 MacGPUPluginContainerManager(); |
| 26 |
| 27 // Allocates a new "fake" PluginWindowHandle, which is used as the |
| 28 // key for the other operations. |
| 29 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(); |
| 30 |
| 31 // Destroys a fake PluginWindowHandle and associated storage. |
| 32 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); |
| 33 |
| 34 // Sets the size and backing store of the plugin instance. |
| 35 void SetSizeAndBackingStore(gfx::PluginWindowHandle id, |
| 36 int32 width, |
| 37 int32 height, |
| 38 uint64 io_surface_identifier); |
| 39 |
| 40 // Takes an update from WebKit about a plugin's position and size and moves |
| 41 // the plugin accordingly. |
| 42 void MovePluginContainer(const webkit_glue::WebPluginGeometry& move); |
| 43 |
| 44 // Draws all of the managed plugin containers into the given OpenGL |
| 45 // context, which must already be current. |
| 46 void Draw(CGLContextObj context); |
| 47 |
| 48 // Called by the container to enqueue its OpenGL texture objects for |
| 49 // deletion. |
| 50 void EnqueueTextureForDeletion(GLuint texture); |
| 51 |
| 52 private: |
| 53 uint32 current_id_; |
| 54 |
| 55 // Maps a "fake" plugin window handle to the corresponding container. |
| 56 MacGPUPluginContainer* MapIDToContainer(gfx::PluginWindowHandle id); |
| 57 |
| 58 // A map that associates plugin window handles with their containers. |
| 59 typedef std::map<gfx::PluginWindowHandle, MacGPUPluginContainer*> |
| 60 PluginWindowToContainerMap; |
| 61 PluginWindowToContainerMap plugin_window_to_container_map_; |
| 62 |
| 63 // A list of OpenGL textures waiting to be deleted |
| 64 std::vector<GLuint> textures_pending_deletion_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(MacGPUPluginContainerManager); |
| 67 }; |
| 68 |
| 69 #endif // WEBKIT_GLUE_PLUGINS_MAC_GPU_PLUGIN_CONTAINER_MANAGER_H_ |
| 70 |
OLD | NEW |