| 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 18 matching lines...) Expand all Loading... |
| 29 // key for the other operations. | 29 // key for the other operations. |
| 30 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque, | 30 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque, |
| 31 bool root); | 31 bool root); |
| 32 | 32 |
| 33 // Destroys a fake PluginWindowHandle and associated storage. | 33 // Destroys a fake PluginWindowHandle and associated storage. |
| 34 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); | 34 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); |
| 35 | 35 |
| 36 // Indicates whether the given PluginWindowHandle is "root", which | 36 // Indicates whether the given PluginWindowHandle is "root", which |
| 37 // means that we are using accelerated compositing and that this one | 37 // means that we are using accelerated compositing and that this one |
| 38 // contains the compositor's output. | 38 // contains the compositor's output. |
| 39 bool IsRootContainer(gfx::PluginWindowHandle id); | 39 bool IsRootContainer(gfx::PluginWindowHandle id) const; |
| 40 |
| 41 // Returns the handle of the compositor surface, or kNullPluginWindow if no |
| 42 // compositor surface is active. |
| 43 gfx::PluginWindowHandle root_container_handle() const { |
| 44 return root_container_handle_; |
| 45 } |
| 46 |
| 47 // Informs the manager if gpu rendering is active. |
| 48 void set_gpu_rendering_active(bool active) { gpu_rendering_active_ = active; } |
| 40 | 49 |
| 41 // Sets the size and backing store of the plugin instance. There are two | 50 // Sets the size and backing store of the plugin instance. There are two |
| 42 // versions: the IOSurface version is used on systems where the IOSurface | 51 // versions: the IOSurface version is used on systems where the IOSurface |
| 43 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on | 52 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on |
| 44 // Mac OS X 10.5 and earlier. | 53 // Mac OS X 10.5 and earlier. |
| 45 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, | 54 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, |
| 46 int32 width, | 55 int32 width, |
| 47 int32 height, | 56 int32 height, |
| 48 uint64 io_surface_identifier); | 57 uint64 io_surface_identifier); |
| 49 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, | 58 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, |
| 50 int32 width, | 59 int32 width, |
| 51 int32 height, | 60 int32 height, |
| 52 TransportDIB::Handle transport_dib); | 61 TransportDIB::Handle transport_dib); |
| 53 | 62 |
| 54 // Takes an update from WebKit about a plugin's position and size and moves | 63 // Takes an update from WebKit about a plugin's position and size and moves |
| 55 // the plugin accordingly. | 64 // the plugin accordingly. |
| 56 void SetPluginContainerGeometry(const webkit_glue::WebPluginGeometry& move); | 65 void SetPluginContainerGeometry(const webkit_glue::WebPluginGeometry& move); |
| 57 | 66 |
| 58 // Draws the plugin container associated with the given id into the given | 67 // Draws the plugin container associated with the given id into the given |
| 59 // OpenGL context, which must already be current. | 68 // OpenGL context, which must already be current. |
| 60 void Draw(CGLContextObj context, | 69 void Draw(CGLContextObj context, gfx::PluginWindowHandle id); |
| 61 gfx::PluginWindowHandle id, | |
| 62 bool draw_root_container); | |
| 63 | 70 |
| 64 // Causes the next Draw call on each container to trigger a texture upload. | 71 // Causes the next Draw call on each container to trigger a texture upload. |
| 65 // Should be called any time the drawing context has changed. | 72 // Should be called any time the drawing context has changed. |
| 66 void ForceTextureReload(); | 73 void ForceTextureReload(); |
| 67 | 74 |
| 68 // Notifies a surface that it has been painted to. | 75 // Notifies a surface that it has been painted to. |
| 69 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id); | 76 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id); |
| 70 | 77 |
| 71 // Returns if a given surface should be shown. | 78 // Returns if a given surface should be shown. |
| 72 bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const; | 79 bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 // The "root" container, which is only used to draw the output of | 92 // The "root" container, which is only used to draw the output of |
| 86 // the accelerated compositor if it is active. Currently, | 93 // the accelerated compositor if it is active. Currently, |
| 87 // accelerated plugins (Core Animation and Pepper 3D) are drawn on | 94 // accelerated plugins (Core Animation and Pepper 3D) are drawn on |
| 88 // top of the page's contents rather than transformed and composited | 95 // top of the page's contents rather than transformed and composited |
| 89 // with the rest of the page. At some point we would like them to be | 96 // with the rest of the page. At some point we would like them to be |
| 90 // treated uniformly with other page elements; when this is done, | 97 // treated uniformly with other page elements; when this is done, |
| 91 // the separate treatment of the root container can go away because | 98 // the separate treatment of the root container can go away because |
| 92 // there will only be one container active when the accelerated | 99 // there will only be one container active when the accelerated |
| 93 // compositor is active. | 100 // compositor is active. |
| 94 AcceleratedSurfaceContainerMac* root_container_; | 101 AcceleratedSurfaceContainerMac* root_container_; |
| 102 gfx::PluginWindowHandle root_container_handle_; |
| 103 |
| 104 // True if gpu rendering is active. The root container is created on demand |
| 105 // and destroyed only when a renderer process exits. When the compositor was |
| 106 // created, this is set to |false| while the compositor is not needed. |
| 107 bool gpu_rendering_active_; |
| 95 | 108 |
| 96 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); | 109 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); |
| 97 }; | 110 }; |
| 98 | 111 |
| 99 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ | 112 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ |
| 100 | 113 |
| OLD | NEW |