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 "gpu/command_buffer/service/in_process_command_buffer.h" |
12 #include "webkit/common/gpu/context_provider_web_context.h" | 13 #include "webkit/common/gpu/context_provider_web_context.h" |
13 | 14 |
| 15 namespace gfx { |
| 16 class GLSurface; |
| 17 } |
| 18 |
14 namespace gpu { | 19 namespace gpu { |
15 class GLInProcessContext; | 20 class GLInProcessContext; |
16 } | 21 } |
17 | 22 |
18 namespace webkit { | 23 namespace webkit { |
19 namespace gpu { | 24 namespace gpu { |
20 class WebGraphicsContext3DInProcessCommandBufferImpl; | 25 class WebGraphicsContext3DInProcessCommandBufferImpl; |
21 } | 26 } |
22 } | 27 } |
23 | 28 |
(...skipping 20 matching lines...) Expand all Loading... |
44 // any thread and is lightweight. | 49 // any thread and is lightweight. |
45 virtual scoped_refptr<cc::ContextProvider> | 50 virtual scoped_refptr<cc::ContextProvider> |
46 GetOffscreenContextProviderForCompositorThread() OVERRIDE; | 51 GetOffscreenContextProviderForCompositorThread() OVERRIDE; |
47 virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( | 52 virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory( |
48 int view_id) OVERRIDE; | 53 int view_id) OVERRIDE; |
49 | 54 |
50 SynchronousInputEventFilter* synchronous_input_event_filter() { | 55 SynchronousInputEventFilter* synchronous_input_event_filter() { |
51 return &synchronous_input_event_filter_; | 56 return &synchronous_input_event_filter_; |
52 } | 57 } |
53 | 58 |
| 59 void SetDeferredGpuService( |
| 60 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); |
54 void CompositorInitializedHardwareDraw(); | 61 void CompositorInitializedHardwareDraw(); |
55 void CompositorReleasedHardwareDraw(); | 62 void CompositorReleasedHardwareDraw(); |
56 | 63 |
| 64 scoped_refptr<cc::ContextProvider> |
| 65 CreateOnscreenContextProviderForCompositorThread( |
| 66 scoped_refptr<gfx::GLSurface> surface); |
| 67 |
57 private: | 68 private: |
58 void ReleaseGlobalHardwareResources(); | 69 void ReleaseGlobalHardwareResources(); |
59 bool CanCreateMainThreadContext(); | 70 bool CanCreateMainThreadContext(); |
60 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> | 71 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> |
61 TryCreateStreamTextureFactory(); | 72 TryCreateStreamTextureFactory(); |
62 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> | |
63 CreateOffscreenContext(); | |
64 | 73 |
65 SynchronousInputEventFilter synchronous_input_event_filter_; | 74 SynchronousInputEventFilter synchronous_input_event_filter_; |
66 | 75 |
67 // Only guards construction and destruction of | 76 // Only guards construction and destruction of |
68 // |offscreen_context_for_compositor_thread_|, not usage. | 77 // |offscreen_context_for_compositor_thread_|, not usage. |
69 base::Lock offscreen_context_for_compositor_thread_lock_; | 78 base::Lock offscreen_context_for_compositor_thread_lock_; |
70 scoped_refptr<webkit::gpu::ContextProviderWebContext> | 79 scoped_refptr<webkit::gpu::ContextProviderWebContext> |
71 offscreen_context_for_main_thread_; | 80 offscreen_context_for_main_thread_; |
72 // This is a pointer to the context owned by | 81 // This is a pointer to the context owned by |
73 // |offscreen_context_for_main_thread_|. | 82 // |offscreen_context_for_main_thread_|. |
74 gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_; | 83 gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_; |
| 84 gpu::GLInProcessContext* wrapped_gl_context_for_compositor_thread_; |
75 scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_; | 85 scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_; |
76 | 86 |
| 87 scoped_refptr<gpu::InProcessCommandBuffer::Service> service_; |
| 88 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> |
| 89 video_context_provider_; |
| 90 |
77 // |num_hardware_compositor_lock_| is updated on UI thread only but can be | 91 // |num_hardware_compositor_lock_| is updated on UI thread only but can be |
78 // read on renderer main thread. | 92 // read on renderer main thread. |
79 base::Lock num_hardware_compositor_lock_; | 93 base::Lock num_hardware_compositor_lock_; |
80 unsigned int num_hardware_compositors_; | 94 unsigned int num_hardware_compositors_; |
81 }; | 95 }; |
82 | 96 |
83 } // namespace content | 97 } // namespace content |
84 | 98 |
85 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMP
L_H_ | 99 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMP
L_H_ |
OLD | NEW |