| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class Size; | 24 class Size; |
| 25 enum class SwapResult; | 25 enum class SwapResult; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ui { | 28 namespace ui { |
| 29 class Compositor; | 29 class Compositor; |
| 30 class ContextFactory; | 30 class ContextFactory; |
| 31 class ContextFactoryObserver; |
| 31 class Texture; | 32 class Texture; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace display_compositor { | 35 namespace display_compositor { |
| 35 class GLHelper; | 36 class GLHelper; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace content { | 39 namespace content { |
| 39 | 40 |
| 40 // This class provides a way to get notified when surface handles get lost. | |
| 41 class CONTENT_EXPORT ImageTransportFactoryObserver { | |
| 42 public: | |
| 43 virtual ~ImageTransportFactoryObserver() {} | |
| 44 | |
| 45 // Notifies that the surface handles generated by ImageTransportFactory were | |
| 46 // lost. | |
| 47 // When this is called, the old resources (e.g. shared context, GL helper) | |
| 48 // still exist, but are about to be destroyed. Getting a reference to those | |
| 49 // resources from the ImageTransportFactory (e.g. through GetGLHelper) will | |
| 50 // return newly recreated, valid resources. | |
| 51 virtual void OnLostResources() = 0; | |
| 52 }; | |
| 53 | |
| 54 // This class provides the interface for creating the support for the | 41 // This class provides the interface for creating the support for the |
| 55 // cross-process image transport, both for creating the shared surface handle | 42 // cross-process image transport, both for creating the shared surface handle |
| 56 // (destination surface for the GPU process) and the transport client (logic for | 43 // (destination surface for the GPU process) and the transport client (logic for |
| 57 // using that surface as a texture). The factory is a process-wide singleton. | 44 // using that surface as a texture). The factory is a process-wide singleton. |
| 58 class CONTENT_EXPORT ImageTransportFactory { | 45 class CONTENT_EXPORT ImageTransportFactory { |
| 59 public: | 46 public: |
| 60 virtual ~ImageTransportFactory() {} | 47 virtual ~ImageTransportFactory() {} |
| 61 | 48 |
| 62 // Initializes the global transport factory. | 49 // Initializes the global transport factory. |
| 63 static void Initialize(); | 50 static void Initialize(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 76 // Gets the image transport factory as a context factory for the compositor. | 63 // Gets the image transport factory as a context factory for the compositor. |
| 77 virtual ui::ContextFactory* GetContextFactory() = 0; | 64 virtual ui::ContextFactory* GetContextFactory() = 0; |
| 78 | 65 |
| 79 virtual cc::SurfaceManager* GetSurfaceManager() = 0; | 66 virtual cc::SurfaceManager* GetSurfaceManager() = 0; |
| 80 | 67 |
| 81 // Gets a GLHelper instance, associated with the shared context. This | 68 // Gets a GLHelper instance, associated with the shared context. This |
| 82 // GLHelper will get destroyed whenever the shared context is lost | 69 // GLHelper will get destroyed whenever the shared context is lost |
| 83 // (ImageTransportFactoryObserver::OnLostResources is called). | 70 // (ImageTransportFactoryObserver::OnLostResources is called). |
| 84 virtual display_compositor::GLHelper* GetGLHelper() = 0; | 71 virtual display_compositor::GLHelper* GetGLHelper() = 0; |
| 85 | 72 |
| 86 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0; | |
| 87 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0; | |
| 88 | |
| 89 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
| 90 // Called with |suspended| as true when the ui::Compositor has been | 74 // Called with |suspended| as true when the ui::Compositor has been |
| 91 // disconnected from an NSView and may be attached to another one. Called | 75 // disconnected from an NSView and may be attached to another one. Called |
| 92 // with |suspended| as false after the ui::Compositor has been connected to | 76 // with |suspended| as false after the ui::Compositor has been connected to |
| 93 // a new NSView and the first commit targeted at the new NSView has | 77 // a new NSView and the first commit targeted at the new NSView has |
| 94 // completed. This ensures that content and frames intended for the old | 78 // completed. This ensures that content and frames intended for the old |
| 95 // NSView will not flash in the new NSView. | 79 // NSView will not flash in the new NSView. |
| 96 virtual void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, | 80 virtual void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, |
| 97 bool suspended) = 0; | 81 bool suspended) = 0; |
| 98 #endif | 82 #endif |
| 99 }; | 83 }; |
| 100 | 84 |
| 101 } // namespace content | 85 } // namespace content |
| 102 | 86 |
| 103 #endif // CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ | 87 #endif // CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ |
| OLD | NEW |