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_IMAGE_TRANSPORT_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 class GLHelper; | 12 class GLHelper; |
13 } | 13 } |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Size; | 16 class Size; |
17 class ScopedMakeCurrent; | 17 class ScopedMakeCurrent; |
18 } | 18 } |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 class Compositor; | 21 class Compositor; |
22 class ContextFactory; | 22 class ContextFactory; |
23 class Texture; | 23 class Texture; |
24 } | 24 } |
25 | 25 |
26 namespace WebKit { | 26 namespace WebKit { |
27 class WebGraphicsContext3D; | 27 class WebGraphicsContext3D; |
28 } | 28 } |
29 | 29 |
30 class ImageTransportClient; | |
31 | |
32 // This class provides a way to get notified when surface handles get lost. | 30 // This class provides a way to get notified when surface handles get lost. |
33 class ImageTransportFactoryObserver { | 31 class ImageTransportFactoryObserver { |
34 public: | 32 public: |
35 virtual ~ImageTransportFactoryObserver() {} | 33 virtual ~ImageTransportFactoryObserver() {} |
36 | 34 |
37 // Notifies that the surface handles generated by ImageTransportFactory for a | 35 // Notifies that the surface handles generated by ImageTransportFactory for a |
38 // given compositor were lost. | 36 // given compositor were lost. |
39 // When this is called, the old resources (e.g. shared context, GL helper) | 37 // When this is called, the old resources (e.g. shared context, GL helper) |
40 // still exist, but are about to be destroyed. Getting a reference to those | 38 // still exist, but are about to be destroyed. Getting a reference to those |
41 // resources from the ImageTransportFactory (e.g. through GetGLHelper) will | 39 // resources from the ImageTransportFactory (e.g. through GetGLHelper) will |
(...skipping 25 matching lines...) Expand all Loading... |
67 | 65 |
68 // Creates a shared surface handle, associated with the compositor. | 66 // Creates a shared surface handle, associated with the compositor. |
69 // Note: the handle may get lost at any time, a state that an | 67 // Note: the handle may get lost at any time, a state that an |
70 // ImageTransportFactoryObserver gets notified of. | 68 // ImageTransportFactoryObserver gets notified of. |
71 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle( | 69 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle( |
72 ui::Compositor* compositor) = 0; | 70 ui::Compositor* compositor) = 0; |
73 | 71 |
74 // Destroys a shared surface handle. | 72 // Destroys a shared surface handle. |
75 virtual void DestroySharedSurfaceHandle(gfx::GLSurfaceHandle surface) = 0; | 73 virtual void DestroySharedSurfaceHandle(gfx::GLSurfaceHandle surface) = 0; |
76 | 74 |
77 // Creates a transport client of a given size, and using the opaque handle | 75 // Creates a transport texture of a given size, and using the opaque handle |
78 // sent by the GPU process. | 76 // sent by the GPU process. |
79 virtual scoped_refptr<ImageTransportClient> CreateTransportClient( | 77 virtual scoped_refptr<ui::Texture> CreateTransportClient( |
80 const gfx::Size& size, | 78 const gfx::Size& size, |
81 uint64* transport_handle) = 0; | 79 uint64* transport_handle, |
| 80 ui::Compositor* compositor) = 0; |
82 | 81 |
83 // Gets a GLHelper instance, associated with the compositor context. This | 82 // Gets a GLHelper instance, associated with the compositor context. This |
84 // GLHelper will get destroyed whenever the context is lost ( | 83 // GLHelper will get destroyed whenever the context is lost ( |
85 virtual content::GLHelper* GetGLHelper(ui::Compositor* compositor) = 0; | 84 virtual content::GLHelper* GetGLHelper(ui::Compositor* compositor) = 0; |
86 | 85 |
87 // Inserts a SyncPoint into the compositor's context. | 86 // Inserts a SyncPoint into the compositor's context. |
88 virtual uint32 InsertSyncPoint(ui::Compositor* compositor) = 0; | 87 virtual uint32 InsertSyncPoint(ui::Compositor* compositor) = 0; |
89 | 88 |
90 // Returns a ScopedMakeCurrent that can be used to make current a context that | |
91 // is shared with the compositor context, e.g. to create a texture in its | |
92 // namespace. The caller gets ownership of the object. | |
93 // This will return NULL when using out-of-process (command buffer) contexts. | |
94 virtual gfx::ScopedMakeCurrent* GetScopedMakeCurrent() = 0; | |
95 | |
96 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0; | 89 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0; |
97 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0; | 90 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0; |
98 }; | 91 }; |
99 | 92 |
100 #endif // CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_H_ | 93 #endif // CONTENT_BROWSER_RENDERER_HOST_IMAGE_TRANSPORT_FACTORY_H_ |
OLD | NEW |