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 16 matching lines...) Expand all Loading... |
27 namespace ui { | 27 namespace ui { |
28 class Compositor; | 28 class Compositor; |
29 class ContextFactory; | 29 class ContextFactory; |
30 class Texture; | 30 class Texture; |
31 } | 31 } |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 class WebGraphicsContext3D; | 34 class WebGraphicsContext3D; |
35 } | 35 } |
36 | 36 |
37 namespace display_compositor { | 37 namespace content { |
38 class GLHelper; | 38 class GLHelper; |
39 } | |
40 | |
41 namespace content { | |
42 | 39 |
43 // This class provides a way to get notified when surface handles get lost. | 40 // This class provides a way to get notified when surface handles get lost. |
44 class CONTENT_EXPORT ImageTransportFactoryObserver { | 41 class CONTENT_EXPORT ImageTransportFactoryObserver { |
45 public: | 42 public: |
46 virtual ~ImageTransportFactoryObserver() {} | 43 virtual ~ImageTransportFactoryObserver() {} |
47 | 44 |
48 // Notifies that the surface handles generated by ImageTransportFactory were | 45 // Notifies that the surface handles generated by ImageTransportFactory were |
49 // lost. | 46 // lost. |
50 // When this is called, the old resources (e.g. shared context, GL helper) | 47 // When this is called, the old resources (e.g. shared context, GL helper) |
51 // still exist, but are about to be destroyed. Getting a reference to those | 48 // still exist, but are about to be destroyed. Getting a reference to those |
(...skipping 25 matching lines...) Expand all Loading... |
77 static ImageTransportFactory* GetInstance(); | 74 static ImageTransportFactory* GetInstance(); |
78 | 75 |
79 // Gets the image transport factory as a context factory for the compositor. | 76 // Gets the image transport factory as a context factory for the compositor. |
80 virtual ui::ContextFactory* GetContextFactory() = 0; | 77 virtual ui::ContextFactory* GetContextFactory() = 0; |
81 | 78 |
82 virtual cc::SurfaceManager* GetSurfaceManager() = 0; | 79 virtual cc::SurfaceManager* GetSurfaceManager() = 0; |
83 | 80 |
84 // Gets a GLHelper instance, associated with the shared context. This | 81 // Gets a GLHelper instance, associated with the shared context. This |
85 // GLHelper will get destroyed whenever the shared context is lost | 82 // GLHelper will get destroyed whenever the shared context is lost |
86 // (ImageTransportFactoryObserver::OnLostResources is called). | 83 // (ImageTransportFactoryObserver::OnLostResources is called). |
87 virtual display_compositor::GLHelper* GetGLHelper() = 0; | 84 virtual GLHelper* GetGLHelper() = 0; |
88 | 85 |
89 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0; | 86 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0; |
90 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0; | 87 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0; |
91 | 88 |
92 #if defined(OS_MACOSX) | 89 #if defined(OS_MACOSX) |
93 virtual void OnGpuSwapBuffersCompleted( | 90 virtual void OnGpuSwapBuffersCompleted( |
94 int surface_id, | 91 int surface_id, |
95 const std::vector<ui::LatencyInfo>& latency_info, | 92 const std::vector<ui::LatencyInfo>& latency_info, |
96 gfx::SwapResult result) = 0; | 93 gfx::SwapResult result) = 0; |
97 | 94 |
98 // Called with |suspended| as true when the ui::Compositor has been | 95 // Called with |suspended| as true when the ui::Compositor has been |
99 // disconnected from an NSView and may be attached to another one. Called | 96 // disconnected from an NSView and may be attached to another one. Called |
100 // with |suspended| as false after the ui::Compositor has been connected to | 97 // with |suspended| as false after the ui::Compositor has been connected to |
101 // a new NSView and the first commit targeted at the new NSView has | 98 // a new NSView and the first commit targeted at the new NSView has |
102 // completed. This ensures that content and frames intended for the old | 99 // completed. This ensures that content and frames intended for the old |
103 // NSView will not flash in the new NSView. | 100 // NSView will not flash in the new NSView. |
104 virtual void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, | 101 virtual void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, |
105 bool suspended) = 0; | 102 bool suspended) = 0; |
106 // Used by GpuProcessHostUIShim to determine if a frame should not be | 103 // Used by GpuProcessHostUIShim to determine if a frame should not be |
107 // displayed because it is targetted to an NSView that has been disconnected. | 104 // displayed because it is targetted to an NSView that has been disconnected. |
108 virtual bool SurfaceShouldNotShowFramesAfterSuspendForRecycle( | 105 virtual bool SurfaceShouldNotShowFramesAfterSuspendForRecycle( |
109 int surface_id) const = 0; | 106 int surface_id) const = 0; |
110 #endif | 107 #endif |
111 }; | 108 }; |
112 | 109 |
113 } // namespace content | 110 } // namespace content |
114 | 111 |
115 #endif // CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ | 112 #endif // CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_ |
OLD | NEW |