| 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 10 matching lines...) Expand all Loading... |
| 21 class AcceleratedSurfaceContainerMac; | 21 class AcceleratedSurfaceContainerMac; |
| 22 | 22 |
| 23 // Helper class that manages the backing store and on-screen rendering | 23 // Helper class that manages the backing store and on-screen rendering |
| 24 // of instances of the GPU plugin on the Mac. | 24 // of instances of the GPU plugin on the Mac. |
| 25 class AcceleratedSurfaceContainerManagerMac { | 25 class AcceleratedSurfaceContainerManagerMac { |
| 26 public: | 26 public: |
| 27 AcceleratedSurfaceContainerManagerMac(); | 27 AcceleratedSurfaceContainerManagerMac(); |
| 28 | 28 |
| 29 // Allocates a new "fake" PluginWindowHandle, which is used as the | 29 // Allocates a new "fake" PluginWindowHandle, which is used as the |
| 30 // key for the other operations. | 30 // key for the other operations. |
| 31 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque); | 31 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque, |
| 32 bool root); |
| 32 | 33 |
| 33 // Destroys a fake PluginWindowHandle and associated storage. | 34 // Destroys a fake PluginWindowHandle and associated storage. |
| 34 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); | 35 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); |
| 35 | 36 |
| 37 // Indicates whether a "root" PluginWindowHandle has been allocated, |
| 38 // which means that we are using accelerated compositing and should |
| 39 // short-circuit the normal drawing process. |
| 40 bool HasRootContainer(); |
| 41 |
| 36 // Sets the size and backing store of the plugin instance. There are two | 42 // Sets the size and backing store of the plugin instance. There are two |
| 37 // versions: the IOSurface version is used on systems where the IOSurface | 43 // versions: the IOSurface version is used on systems where the IOSurface |
| 38 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on | 44 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on |
| 39 // Mac OS X 10.5 and earlier. | 45 // Mac OS X 10.5 and earlier. |
| 40 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, | 46 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, |
| 41 int32 width, | 47 int32 width, |
| 42 int32 height, | 48 int32 height, |
| 43 uint64 io_surface_identifier); | 49 uint64 io_surface_identifier); |
| 44 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, | 50 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, |
| 45 int32 width, | 51 int32 width, |
| 46 int32 height, | 52 int32 height, |
| 47 TransportDIB::Handle transport_dib); | 53 TransportDIB::Handle transport_dib); |
| 48 | 54 |
| 49 // Takes an update from WebKit about a plugin's position and size and moves | 55 // Takes an update from WebKit about a plugin's position and size and moves |
| 50 // the plugin accordingly. | 56 // the plugin accordingly. |
| 51 void MovePluginContainer(const webkit_glue::WebPluginGeometry& move); | 57 void MovePluginContainer(const webkit_glue::WebPluginGeometry& move); |
| 52 | 58 |
| 53 // Draws all of the managed plugin containers into the given OpenGL | 59 // Draws all of the managed plugin containers into the given OpenGL |
| 54 // context, which must already be current. | 60 // context, which must already be current. |
| 55 void Draw(CGLContextObj context); | 61 void Draw(CGLContextObj context, |
| 62 bool draw_root_container); |
| 56 | 63 |
| 57 // Causes the next Draw call on each container to trigger a texture upload. | 64 // Causes the next Draw call on each container to trigger a texture upload. |
| 58 // Should be called any time the drawing context has changed. | 65 // Should be called any time the drawing context has changed. |
| 59 void ForceTextureReload(); | 66 void ForceTextureReload(); |
| 60 | 67 |
| 61 // Called by the container to enqueue its OpenGL texture objects for | 68 // Called by the container to enqueue its OpenGL texture objects for |
| 62 // deletion. | 69 // deletion. |
| 63 void EnqueueTextureForDeletion(GLuint texture); | 70 void EnqueueTextureForDeletion(GLuint texture); |
| 64 | 71 |
| 65 private: | 72 private: |
| 66 uint32 current_id_; | 73 uint32 current_id_; |
| 67 | 74 |
| 68 // Maps a "fake" plugin window handle to the corresponding container. | 75 // Maps a "fake" plugin window handle to the corresponding container. |
| 69 AcceleratedSurfaceContainerMac* MapIDToContainer(gfx::PluginWindowHandle id); | 76 AcceleratedSurfaceContainerMac* MapIDToContainer(gfx::PluginWindowHandle id); |
| 70 | 77 |
| 71 // A map that associates plugin window handles with their containers. | 78 // A map that associates plugin window handles with their containers. |
| 72 typedef std::map<gfx::PluginWindowHandle, AcceleratedSurfaceContainerMac*> | 79 typedef std::map<gfx::PluginWindowHandle, AcceleratedSurfaceContainerMac*> |
| 73 PluginWindowToContainerMap; | 80 PluginWindowToContainerMap; |
| 74 PluginWindowToContainerMap plugin_window_to_container_map_; | 81 PluginWindowToContainerMap plugin_window_to_container_map_; |
| 75 | 82 |
| 83 // The "root" container, which is only used to draw the output of |
| 84 // the accelerated compositor if it is active. Currently, |
| 85 // accelerated plugins (Core Animation and Pepper 3D) are drawn on |
| 86 // top of the page's contents rather than transformed and composited |
| 87 // with the rest of the page. At some point we would like them to be |
| 88 // treated uniformly with other page elements; when this is done, |
| 89 // the separate treatment of the root container can go away because |
| 90 // there will only be one container active when the accelerated |
| 91 // compositor is active. |
| 92 AcceleratedSurfaceContainerMac* root_container_; |
| 93 |
| 76 // A list of OpenGL textures waiting to be deleted | 94 // A list of OpenGL textures waiting to be deleted |
| 77 std::vector<GLuint> textures_pending_deletion_; | 95 std::vector<GLuint> textures_pending_deletion_; |
| 78 | 96 |
| 79 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); | 97 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); |
| 80 }; | 98 }; |
| 81 | 99 |
| 82 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ | 100 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ |
| 83 | 101 |
| OLD | NEW |