OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_ |
6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_ | 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class MessageLoopProxy; | 12 class MessageLoopProxy; |
13 } | 13 } |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 class ContextProvider; | 16 class ContextProvider; |
17 class OutputSurface; | 17 class OutputSurface; |
18 } | 18 } |
19 | 19 |
20 namespace webkit { | |
21 namespace gpu { | |
22 class ContextProviderWebContext; | |
23 } | |
24 } | |
25 | |
26 namespace content { | 20 namespace content { |
27 | 21 |
28 class InputHandlerManagerClient; | 22 class InputHandlerManagerClient; |
29 class StreamTextureFactory; | 23 class StreamTextureFactory; |
30 | 24 |
31 // Decouples creation from usage of the parts needed for the synchonous | 25 // Decouples creation from usage of the parts needed for the synchonous |
32 // compositor rendering path. In practice this is only used in single | 26 // compositor rendering path. In practice this is only used in single |
33 // process mode (namely, for Android WebView) hence the implementation of | 27 // process mode (namely, for Android WebView) hence the implementation of |
34 // this will be injected from the logical 'browser' side code. | 28 // this will be injected from the logical 'browser' side code. |
35 class SynchronousCompositorFactory { | 29 class SynchronousCompositorFactory { |
36 public: | 30 public: |
37 // Must only be called once, e.g. on startup. Ownership of |instance| remains | 31 // Must only be called once, e.g. on startup. Ownership of |instance| remains |
38 // with the caller. | 32 // with the caller. |
39 static void SetInstance(SynchronousCompositorFactory* instance); | 33 static void SetInstance(SynchronousCompositorFactory* instance); |
40 static SynchronousCompositorFactory* GetInstance(); | 34 static SynchronousCompositorFactory* GetInstance(); |
41 | 35 |
42 virtual scoped_refptr<base::MessageLoopProxy> | 36 virtual scoped_refptr<base::MessageLoopProxy> |
43 GetCompositorMessageLoop() = 0; | 37 GetCompositorMessageLoop() = 0; |
44 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( | 38 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( |
45 int routing_id) = 0; | 39 int routing_id) = 0; |
46 | 40 |
47 // The factory maintains ownership of the returned interface. | 41 // The factory maintains ownership of the returned interface. |
48 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0; | 42 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0; |
49 | 43 |
50 virtual scoped_refptr<webkit::gpu::ContextProviderWebContext> | 44 virtual scoped_refptr<cc::ContextProvider> |
51 GetOffscreenContextProviderForMainThread() = 0; | 45 GetOffscreenContextProviderForMainThread() = 0; |
52 virtual scoped_refptr<cc::ContextProvider> | 46 virtual scoped_refptr<cc::ContextProvider> |
53 GetOffscreenContextProviderForCompositorThread() = 0; | 47 GetOffscreenContextProviderForCompositorThread() = 0; |
54 virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( | 48 virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( |
55 int view_id) = 0; | 49 int view_id) = 0; |
56 | 50 |
57 protected: | 51 protected: |
58 SynchronousCompositorFactory() {} | 52 SynchronousCompositorFactory() {} |
59 virtual ~SynchronousCompositorFactory() {} | 53 virtual ~SynchronousCompositorFactory() {} |
60 }; | 54 }; |
61 | 55 |
62 } | 56 } |
63 | 57 |
64 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_ | 58 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_ |
OLD | NEW |