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 "cc/blink/context_provider_web_context.h" | 9 #include "cc/blink/context_provider_web_context.h" |
10 #include "content/browser/android/in_process/synchronous_input_event_filter.h" | 10 #include "content/browser/android/in_process/synchronous_input_event_filter.h" |
11 #include "content/renderer/android/synchronous_compositor_factory.h" | 11 #include "content/renderer/android/synchronous_compositor_factory.h" |
12 #include "content/renderer/media/android/stream_texture_factory_synchronous_impl
.h" | 12 #include "content/renderer/media/android/stream_texture_factory_synchronous_impl
.h" |
13 #include "gpu/command_buffer/service/in_process_command_buffer.h" | 13 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
14 | 14 |
| 15 namespace base { |
| 16 class Thread; |
| 17 } |
| 18 |
15 namespace gpu { | 19 namespace gpu { |
16 class GLInProcessContext; | 20 class GLInProcessContext; |
17 } | 21 } |
18 | 22 |
19 namespace gpu_blink { | 23 namespace gpu_blink { |
20 class WebGraphicsContext3DInProcessCommandBufferImpl; | 24 class WebGraphicsContext3DInProcessCommandBufferImpl; |
21 } | 25 } |
22 | 26 |
23 namespace content { | 27 namespace content { |
24 | 28 |
| 29 class InProcessChildThreadParams; |
| 30 |
25 class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { | 31 class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { |
26 public: | 32 public: |
27 SynchronousCompositorFactoryImpl(); | 33 SynchronousCompositorFactoryImpl(); |
28 ~SynchronousCompositorFactoryImpl() override; | 34 ~SynchronousCompositorFactoryImpl() override; |
29 | 35 |
30 // SynchronousCompositorFactory | 36 // SynchronousCompositorFactory |
31 scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner() | 37 scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner() |
32 override; | 38 override; |
33 bool RecordFullLayer() override; | 39 bool RecordFullLayer() override; |
34 scoped_ptr<cc::OutputSurface> CreateOutputSurface( | 40 scoped_ptr<cc::OutputSurface> CreateOutputSurface( |
(...skipping 13 matching lines...) Expand all Loading... |
48 CreateOffscreenGraphicsContext3D( | 54 CreateOffscreenGraphicsContext3D( |
49 const blink::WebGraphicsContext3D::Attributes& attributes) override; | 55 const blink::WebGraphicsContext3D::Attributes& attributes) override; |
50 gpu::GPUInfo GetGPUInfo() const override; | 56 gpu::GPUInfo GetGPUInfo() const override; |
51 | 57 |
52 SynchronousInputEventFilter* synchronous_input_event_filter() { | 58 SynchronousInputEventFilter* synchronous_input_event_filter() { |
53 return &synchronous_input_event_filter_; | 59 return &synchronous_input_event_filter_; |
54 } | 60 } |
55 | 61 |
56 void SetDeferredGpuService( | 62 void SetDeferredGpuService( |
57 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); | 63 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); |
| 64 base::Thread* CreateInProcessGpuThread( |
| 65 const InProcessChildThreadParams& params); |
58 void SetRecordFullDocument(bool record_full_document); | 66 void SetRecordFullDocument(bool record_full_document); |
59 void CompositorInitializedHardwareDraw(); | 67 void CompositorInitializedHardwareDraw(); |
60 void CompositorReleasedHardwareDraw(); | 68 void CompositorReleasedHardwareDraw(); |
61 | 69 |
62 scoped_refptr<cc::ContextProvider> CreateContextProviderForCompositor(); | 70 scoped_refptr<cc::ContextProvider> CreateContextProviderForCompositor(); |
63 | 71 |
64 private: | 72 private: |
65 bool CanCreateMainThreadContext(); | 73 bool CanCreateMainThreadContext(); |
66 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> | 74 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> |
67 TryCreateStreamTextureFactory(); | 75 TryCreateStreamTextureFactory(); |
68 void RestoreContextOnMainThread(); | 76 void RestoreContextOnMainThread(); |
| 77 scoped_refptr<gpu::InProcessCommandBuffer::Service> GpuThreadService(); |
69 | 78 |
70 SynchronousInputEventFilter synchronous_input_event_filter_; | 79 SynchronousInputEventFilter synchronous_input_event_filter_; |
71 | 80 |
72 scoped_refptr<gpu::InProcessCommandBuffer::Service> service_; | 81 scoped_refptr<gpu::InProcessCommandBuffer::Service> android_view_service_; |
| 82 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_thread_service_; |
73 | 83 |
74 class VideoContextProvider; | 84 class VideoContextProvider; |
75 scoped_refptr<VideoContextProvider> video_context_provider_; | 85 scoped_refptr<VideoContextProvider> video_context_provider_; |
76 | 86 |
77 bool record_full_layer_; | 87 bool record_full_layer_; |
78 | 88 |
79 // |num_hardware_compositor_lock_| is updated on UI thread only but can be | 89 // |num_hardware_compositor_lock_| is updated on UI thread only but can be |
80 // read on renderer main thread. | 90 // read on renderer main thread. |
81 base::Lock num_hardware_compositor_lock_; | 91 base::Lock num_hardware_compositor_lock_; |
82 unsigned int num_hardware_compositors_; | 92 unsigned int num_hardware_compositors_; |
83 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 93 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
84 }; | 94 }; |
85 | 95 |
86 } // namespace content | 96 } // namespace content |
87 | 97 |
88 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMP
L_H_ | 98 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMP
L_H_ |
OLD | NEW |