Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: content/browser/aura/image_transport_factory.h

Issue 22935009: Add content::SurfaceCapturer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_stride
Patch Set: 89e2665f Rebase. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_AURA_IMAGE_TRANSPORT_FACTORY_H_ 5 #ifndef CONTENT_BROWSER_AURA_IMAGE_TRANSPORT_FACTORY_H_
6 #define CONTENT_BROWSER_AURA_IMAGE_TRANSPORT_FACTORY_H_ 6 #define CONTENT_BROWSER_AURA_IMAGE_TRANSPORT_FACTORY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "content/common/gpu/surface_capturer.h"
11 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 class Size; 15 class Size;
15 } 16 }
16 17
17 namespace ui { 18 namespace ui {
19 class Compositor;
18 class ContextFactory; 20 class ContextFactory;
19 class Texture; 21 class Texture;
20 } 22 }
21 23
22 namespace WebKit { 24 namespace WebKit {
23 class WebGraphicsContext3D; 25 class WebGraphicsContext3D;
24 } 26 }
25 27
26 namespace content { 28 namespace content {
27 class GLHelper; 29 class GLHelper;
28 30
29 // This class provides a way to get notified when surface handles get lost. 31 // This class provides a way to get notified when surface handles get lost.
30 class ImageTransportFactoryObserver { 32 class ImageTransportFactoryObserver {
31 public: 33 public:
32 virtual ~ImageTransportFactoryObserver() {} 34 virtual ~ImageTransportFactoryObserver() {}
33 35
34 // Notifies that the surface handles generated by ImageTransportFactory were 36 // Notifies that the surface handles generated by ImageTransportFactory were
35 // lost. 37 // lost.
36 // When this is called, the old resources (e.g. shared context, GL helper) 38 // When this is called, the old resources (e.g. shared context, GL helper)
37 // still exist, but are about to be destroyed. Getting a reference to those 39 // still exist, but are about to be destroyed. Getting a reference to those
38 // resources from the ImageTransportFactory (e.g. through GetGLHelper) will 40 // resources from the ImageTransportFactory (e.g. through GetGLHelper) will
39 // return newly recreated, valid resources. 41 // return newly recreated, valid resources.
40 virtual void OnLostResources() = 0; 42 virtual void OnLostResources() = 0;
41 }; 43 };
42 44
45 // This class provides the interface for creating a ui::ContextFactory that
46 // supports creation of a SurfaceCapturer that captures the output of a given
47 // ui::Compositor. The factory instance is retrieved from the
48 // ImageTransportFactory.
49 class SurfaceCapturingContextFactory {
50 public:
51 virtual ~SurfaceCapturingContextFactory() {}
52
53 // Creates a SurfaceCapturer that captures frames from the given compositor's
54 // current output surface.
55 virtual scoped_ptr<SurfaceCapturer> CreateOutputSurfaceCapturer(
56 ui::Compositor* compositor,
57 SurfaceCapturer::Client* client) = 0;
58 };
59
43 // This class provides the interface for creating the support for the 60 // This class provides the interface for creating the support for the
44 // cross-process image transport, both for creating the shared surface handle 61 // cross-process image transport, both for creating the shared surface handle
45 // (destination surface for the GPU process) and the transport client (logic for 62 // (destination surface for the GPU process) and the transport client (logic for
46 // using that surface as a texture). The factory is a process-wide singleton. 63 // using that surface as a texture). The factory is a process-wide singleton.
47 class ImageTransportFactory { 64 class ImageTransportFactory {
48 public: 65 public:
49 virtual ~ImageTransportFactory() {} 66 virtual ~ImageTransportFactory() {}
50 67
51 // Initialize the global transport factory. 68 // Initialize the global transport factory.
52 static void Initialize(); 69 static void Initialize();
53 70
54 // Terminates the global transport factory. 71 // Terminates the global transport factory.
55 static void Terminate(); 72 static void Terminate();
56 73
57 // Gets the factory instance. 74 // Gets the factory instance.
58 static ImageTransportFactory* GetInstance(); 75 static ImageTransportFactory* GetInstance();
59 76
60 // Gets the image transport factory as a context factory for the compositor. 77 // Gets the image transport factory as a context factory for the compositor.
61 virtual ui::ContextFactory* AsContextFactory() = 0; 78 virtual ui::ContextFactory* AsContextFactory() = 0;
62 79
80 // Gets the image transport factory as a surface capturer factory for the
81 // compositor.
82 virtual SurfaceCapturingContextFactory*
83 AsSurfaceCapturingContextFactory() = 0;
84
63 // Creates a shared surface handle. 85 // Creates a shared surface handle.
64 // Note: the handle may get lost at any time, a state that an 86 // Note: the handle may get lost at any time, a state that an
65 // ImageTransportFactoryObserver gets notified of. 87 // ImageTransportFactoryObserver gets notified of.
66 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() = 0; 88 virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() = 0;
67 89
68 // Destroys a shared surface handle. 90 // Destroys a shared surface handle.
69 virtual void DestroySharedSurfaceHandle(gfx::GLSurfaceHandle surface) = 0; 91 virtual void DestroySharedSurfaceHandle(gfx::GLSurfaceHandle surface) = 0;
70 92
71 // Creates a transport texture for a given scale factor. 93 // Creates a transport texture for a given scale factor.
72 virtual scoped_refptr<ui::Texture> CreateTransportClient( 94 virtual scoped_refptr<ui::Texture> CreateTransportClient(
(...skipping 17 matching lines...) Expand all
90 // Blocks waiting for the sync point on the service side. 112 // Blocks waiting for the sync point on the service side.
91 virtual void WaitSyncPoint(uint32 sync_point) = 0; 113 virtual void WaitSyncPoint(uint32 sync_point) = 0;
92 114
93 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0; 115 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0;
94 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0; 116 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0;
95 }; 117 };
96 118
97 } // namespace content 119 } // namespace content
98 120
99 #endif // CONTENT_BROWSER_AURA_IMAGE_TRANSPORT_FACTORY_H_ 121 #endif // CONTENT_BROWSER_AURA_IMAGE_TRANSPORT_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698