| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MANAGER_MAC_
H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MANAGER_MAC_
H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MANAGER_MAC_
H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_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 23 matching lines...) Expand all Loading... |
| 34 ~AcceleratedSurfaceContainerManagerMac(); | 34 ~AcceleratedSurfaceContainerManagerMac(); |
| 35 | 35 |
| 36 // Allocates a new "fake" PluginWindowHandle, which is used as the | 36 // Allocates a new "fake" PluginWindowHandle, which is used as the |
| 37 // key for the other operations. | 37 // key for the other operations. |
| 38 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque, | 38 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque, |
| 39 bool root); | 39 bool root); |
| 40 | 40 |
| 41 // Destroys a fake PluginWindowHandle and associated storage. | 41 // Destroys a fake PluginWindowHandle and associated storage. |
| 42 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); | 42 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id); |
| 43 | 43 |
| 44 // Indicates whether the given PluginWindowHandle is "root", which | |
| 45 // means that we are using accelerated compositing and that this one | |
| 46 // contains the compositor's output. | |
| 47 bool IsRootContainer(gfx::PluginWindowHandle id) const; | |
| 48 | |
| 49 // Returns the handle of the compositor surface, or kNullPluginWindow if no | |
| 50 // compositor surface is active. | |
| 51 gfx::PluginWindowHandle root_container_handle() const { | |
| 52 return root_container_handle_; | |
| 53 } | |
| 54 | |
| 55 // Informs the manager if gpu rendering is active. | |
| 56 void set_gpu_rendering_active(bool active); | |
| 57 | |
| 58 // Sets the size and backing store of the plugin instance. There are two | 44 // Sets the size and backing store of the plugin instance. There are two |
| 59 // versions: the IOSurface version is used on systems where the IOSurface | 45 // versions: the IOSurface version is used on systems where the IOSurface |
| 60 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on | 46 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on |
| 61 // Mac OS X 10.5 and earlier. | 47 // Mac OS X 10.5 and earlier. |
| 62 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, | 48 void SetSizeAndIOSurface(gfx::PluginWindowHandle id, |
| 63 int32 width, | 49 int32 width, |
| 64 int32 height, | 50 int32 height, |
| 65 uint64 io_surface_identifier); | 51 uint64 io_surface_identifier); |
| 66 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, | 52 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id, |
| 67 int32 width, | 53 int32 width, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 81 // Should be called any time the drawing context has changed. | 67 // Should be called any time the drawing context has changed. |
| 82 void ForceTextureReload(); | 68 void ForceTextureReload(); |
| 83 | 69 |
| 84 // Notifies a surface that it has been painted to. | 70 // Notifies a surface that it has been painted to. |
| 85 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, | 71 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, |
| 86 uint64 surface_handle); | 72 uint64 surface_handle); |
| 87 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, | 73 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, |
| 88 uint64 surface_handle, | 74 uint64 surface_handle, |
| 89 const gfx::Rect& update_rect); | 75 const gfx::Rect& update_rect); |
| 90 | 76 |
| 91 // Notifies the root container that its surface is invalid. | |
| 92 void SetRootSurfaceInvalid(); | |
| 93 | |
| 94 // Returns if a given surface should be shown. | 77 // Returns if a given surface should be shown. |
| 95 bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const; | 78 bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const; |
| 96 private: | 79 private: |
| 97 uint32 current_id_; | 80 uint32 current_id_; |
| 98 | 81 |
| 99 // Maps a "fake" plugin window handle to the corresponding container. | 82 // Maps a "fake" plugin window handle to the corresponding container. |
| 100 AcceleratedSurfaceContainerMac* | 83 AcceleratedSurfaceContainerMac* |
| 101 MapIDToContainer(gfx::PluginWindowHandle id) const; | 84 MapIDToContainer(gfx::PluginWindowHandle id) const; |
| 102 | 85 |
| 103 // A map that associates plugin window handles with their containers. | 86 // A map that associates plugin window handles with their containers. |
| 104 typedef std::map<gfx::PluginWindowHandle, AcceleratedSurfaceContainerMac*> | 87 typedef std::map<gfx::PluginWindowHandle, AcceleratedSurfaceContainerMac*> |
| 105 PluginWindowToContainerMap; | 88 PluginWindowToContainerMap; |
| 106 PluginWindowToContainerMap plugin_window_to_container_map_; | 89 PluginWindowToContainerMap plugin_window_to_container_map_; |
| 107 | 90 |
| 108 // The "root" container, which is only used to draw the output of | |
| 109 // the accelerated compositor if it is active. Currently, | |
| 110 // accelerated plugins (Core Animation and Pepper 3D) are drawn on | |
| 111 // top of the page's contents rather than transformed and composited | |
| 112 // with the rest of the page. At some point we would like them to be | |
| 113 // treated uniformly with other page elements; when this is done, | |
| 114 // the separate treatment of the root container can go away because | |
| 115 // there will only be one container active when the accelerated | |
| 116 // compositor is active. | |
| 117 AcceleratedSurfaceContainerMac* root_container_; | |
| 118 gfx::PluginWindowHandle root_container_handle_; | |
| 119 | |
| 120 // True if gpu rendering is active. The root container is created on demand | |
| 121 // and destroyed only when a renderer process exits. When the compositor was | |
| 122 // created, this is set to |false| while the compositor is not needed. | |
| 123 bool gpu_rendering_active_; | |
| 124 | |
| 125 // Both |plugin_window_to_container_map_| and the | 91 // Both |plugin_window_to_container_map_| and the |
| 126 // AcceleratedSurfaceContainerMac in it are not threadsafe, but accessed from | 92 // AcceleratedSurfaceContainerMac in it are not threadsafe, but accessed from |
| 127 // multiple threads. All these accesses are guarded by this lock. | 93 // multiple threads. All these accesses are guarded by this lock. |
| 128 mutable base::Lock lock_; | 94 mutable base::Lock lock_; |
| 129 | 95 |
| 130 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); | 96 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); |
| 131 }; | 97 }; |
| 132 | 98 |
| 133 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MANAGER_M
AC_H_ | 99 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_MANAGER_M
AC_H_ |
| OLD | NEW |