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

Side by Side Diff: trunk/src/content/browser/compositor/image_transport_factory.h

Issue 137853019: Revert 245131 "Add the UI compositor to the Mac build", which caused Mac ASan redness (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_
6 #define CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/common/content_export.h"
13 #include "ui/gfx/native_widget_types.h"
14
15 namespace gfx {
16 class Size;
17 }
18
19 namespace ui {
20 class ContextFactory;
21 class Texture;
22 }
23
24 namespace blink {
25 class WebGraphicsContext3D;
26 }
27
28 namespace content {
29 class GLHelper;
30
31 // This class provides a way to get notified when surface handles get lost.
32 class CONTENT_EXPORT ImageTransportFactoryObserver {
33 public:
34 virtual ~ImageTransportFactoryObserver() {}
35
36 // Notifies that the surface handles generated by ImageTransportFactory were
37 // lost.
38 // When this is called, the old resources (e.g. shared context, GL helper)
39 // still exist, but are about to be destroyed. Getting a reference to those
40 // resources from the ImageTransportFactory (e.g. through GetGLHelper) will
41 // return newly recreated, valid resources.
42 virtual void OnLostResources() = 0;
43 };
44
45 // This class provides the interface for creating the support for the
46 // cross-process image transport, both for creating the shared surface handle
47 // (destination surface for the GPU process) and the transport client (logic for
48 // using that surface as a texture). The factory is a process-wide singleton.
49 class CONTENT_EXPORT ImageTransportFactory {
50 public:
51 virtual ~ImageTransportFactory() {}
52
53 // Initializes the global transport factory.
54 static void Initialize();
55
56 // Initializes the global transport factory for unit tests using the provided
57 // context factory.
58 static void InitializeForUnitTests(
59 scoped_ptr<ui::ContextFactory> test_factory);
60
61 // Terminates the global transport factory.
62 static void Terminate();
63
64 // Gets the factory instance.
65 static ImageTransportFactory* GetInstance();
66
67 // Gets the image transport factory as a context factory for the compositor.
68 virtual ui::ContextFactory* AsContextFactory() = 0;
69
70 virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() = 0;
71
72 // Creates a transport texture for a given scale factor.
73 virtual scoped_refptr<ui::Texture> CreateTransportClient(
74 float device_scale_factor) = 0;
75
76 // Variant of CreateTransportClient() that deletes the texture on the GPU when
77 // the returned value is deleted.
78 virtual scoped_refptr<ui::Texture> CreateOwnedTexture(
79 const gfx::Size& size,
80 float device_scale_factor,
81 unsigned int texture_id) = 0;
82
83 // Gets a GLHelper instance, associated with the shared context. This
84 // GLHelper will get destroyed whenever the shared context is lost
85 // (ImageTransportFactoryObserver::OnLostResources is called).
86 virtual GLHelper* GetGLHelper() = 0;
87
88 virtual void AddObserver(ImageTransportFactoryObserver* observer) = 0;
89 virtual void RemoveObserver(ImageTransportFactoryObserver* observer) = 0;
90 };
91
92 } // namespace content
93
94 #endif // CONTENT_BROWSER_COMPOSITOR_IMAGE_TRANSPORT_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698