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_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H
_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H
_ |
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H
_ | 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H
_ |
7 | 7 |
8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
9 #include "content/browser/android/in_process/synchronous_input_event_filter.h" | 9 #include "content/browser/android/in_process/synchronous_input_event_filter.h" |
10 #include "content/renderer/android/synchronous_compositor_factory.h" | 10 #include "content/renderer/android/synchronous_compositor_factory.h" |
11 #include "content/renderer/media/android/stream_texture_factory_android_synchron
ous_impl.h" | 11 #include "content/renderer/media/android/stream_texture_factory_android_synchron
ous_impl.h" |
| 12 #include "webkit/common/gpu/context_provider_web_context.h" |
12 | 13 |
13 namespace gpu { | 14 namespace gpu { |
14 class GLInProcessContext; | 15 class GLInProcessContext; |
15 } | 16 } |
16 | 17 |
17 namespace webkit { | 18 namespace webkit { |
18 namespace gpu { | 19 namespace gpu { |
19 class WebGraphicsContext3DInProcessCommandBufferImpl; | 20 class WebGraphicsContext3DInProcessCommandBufferImpl; |
20 } | 21 } |
21 } | 22 } |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 | 25 |
25 class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { | 26 class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { |
26 public: | 27 public: |
27 SynchronousCompositorFactoryImpl(); | 28 SynchronousCompositorFactoryImpl(); |
28 virtual ~SynchronousCompositorFactoryImpl(); | 29 virtual ~SynchronousCompositorFactoryImpl(); |
29 | 30 |
30 // SynchronousCompositorFactory | 31 // SynchronousCompositorFactory |
31 virtual scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop() | 32 virtual scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop() |
32 OVERRIDE; | 33 OVERRIDE; |
33 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(int routing_id) | 34 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(int routing_id) |
34 OVERRIDE; | 35 OVERRIDE; |
35 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() OVERRIDE; | 36 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() OVERRIDE; |
36 virtual scoped_refptr<cc::ContextProvider> | 37 virtual scoped_refptr<webkit::gpu::ContextProviderWebContext> |
37 GetOffscreenContextProviderForMainThread() OVERRIDE; | 38 GetOffscreenContextProviderForMainThread() OVERRIDE; |
38 // This is called on both renderer main thread (offscreen context creation | 39 // This is called on both renderer main thread (offscreen context creation |
39 // path shared between cross-process and in-process platforms) and renderer | 40 // path shared between cross-process and in-process platforms) and renderer |
40 // compositor impl thread (InitializeHwDraw) in order to support Android | 41 // compositor impl thread (InitializeHwDraw) in order to support Android |
41 // WebView synchronously enable and disable hardware mode multiple times in | 42 // WebView synchronously enable and disable hardware mode multiple times in |
42 // the same task. This is ok because in-process WGC3D creation may happen on | 43 // the same task. This is ok because in-process WGC3D creation may happen on |
43 // any thread and is lightweight. | 44 // any thread and is lightweight. |
44 virtual scoped_refptr<cc::ContextProvider> | 45 virtual scoped_refptr<cc::ContextProvider> |
45 GetOffscreenContextProviderForCompositorThread() OVERRIDE; | 46 GetOffscreenContextProviderForCompositorThread() OVERRIDE; |
46 virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( | 47 virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( |
(...skipping 12 matching lines...) Expand all Loading... |
59 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> | 60 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> |
60 TryCreateStreamTextureFactory(); | 61 TryCreateStreamTextureFactory(); |
61 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> | 62 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> |
62 CreateOffscreenContext(); | 63 CreateOffscreenContext(); |
63 | 64 |
64 SynchronousInputEventFilter synchronous_input_event_filter_; | 65 SynchronousInputEventFilter synchronous_input_event_filter_; |
65 | 66 |
66 // Only guards construction and destruction of | 67 // Only guards construction and destruction of |
67 // |offscreen_context_for_compositor_thread_|, not usage. | 68 // |offscreen_context_for_compositor_thread_|, not usage. |
68 base::Lock offscreen_context_for_compositor_thread_lock_; | 69 base::Lock offscreen_context_for_compositor_thread_lock_; |
69 scoped_refptr<cc::ContextProvider> offscreen_context_for_main_thread_; | 70 scoped_refptr<webkit::gpu::ContextProviderWebContext> |
| 71 offscreen_context_for_main_thread_; |
70 // This is a pointer to the context owned by | 72 // This is a pointer to the context owned by |
71 // |offscreen_context_for_main_thread_|. | 73 // |offscreen_context_for_main_thread_|. |
72 gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_; | 74 gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_; |
73 scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_; | 75 scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_; |
74 | 76 |
75 // |num_hardware_compositor_lock_| is updated on UI thread only but can be | 77 // |num_hardware_compositor_lock_| is updated on UI thread only but can be |
76 // read on renderer main thread. | 78 // read on renderer main thread. |
77 base::Lock num_hardware_compositor_lock_; | 79 base::Lock num_hardware_compositor_lock_; |
78 unsigned int num_hardware_compositors_; | 80 unsigned int num_hardware_compositors_; |
79 }; | 81 }; |
80 | 82 |
81 } // namespace content | 83 } // namespace content |
82 | 84 |
83 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMP
L_H_ | 85 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMP
L_H_ |
OLD | NEW |