OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GPU_GPU_CHILD_THREAD_H_ | 5 #ifndef CONTENT_GPU_GPU_CHILD_THREAD_H_ |
6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ | 6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "gpu/ipc/service/gpu_config.h" | 29 #include "gpu/ipc/service/gpu_config.h" |
30 #include "gpu/ipc/service/x_util.h" | 30 #include "gpu/ipc/service/x_util.h" |
31 #include "mojo/public/cpp/bindings/associated_binding_set.h" | 31 #include "mojo/public/cpp/bindings/associated_binding_set.h" |
32 #include "mojo/public/cpp/bindings/binding_set.h" | 32 #include "mojo/public/cpp/bindings/binding_set.h" |
33 #include "services/service_manager/public/interfaces/service_factory.mojom.h" | 33 #include "services/service_manager/public/interfaces/service_factory.mojom.h" |
34 #include "services/ui/gpu/gpu_service.h" | 34 #include "services/ui/gpu/gpu_service.h" |
35 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" | 35 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" |
36 #include "ui/gfx/native_widget_types.h" | 36 #include "ui/gfx/native_widget_types.h" |
37 | 37 |
38 namespace gpu { | 38 namespace gpu { |
39 class GpuMemoryBufferFactory; | |
40 class GpuWatchdogThread; | 39 class GpuWatchdogThread; |
41 } | 40 } |
42 | 41 |
43 namespace content { | 42 namespace content { |
44 class GpuServiceFactory; | 43 class GpuServiceFactory; |
45 | 44 |
46 // The main thread of the GPU child process. There will only ever be one of | 45 // The main thread of the GPU child process. There will only ever be one of |
47 // these per process. It does process initialization and shutdown. It forwards | 46 // these per process. It does process initialization and shutdown. It forwards |
48 // IPC messages to gpu::GpuChannelManager, which is responsible for issuing | 47 // IPC messages to gpu::GpuChannelManager, which is responsible for issuing |
49 // rendering commands to the GPU. | 48 // rendering commands to the GPU. |
50 class GpuChildThread : public ChildThreadImpl, | 49 class GpuChildThread : public ChildThreadImpl, |
51 public ui::mojom::GpuMain, | 50 public ui::mojom::GpuMain, |
52 public base::FieldTrialList::Observer { | 51 public base::FieldTrialList::Observer { |
53 public: | 52 public: |
54 struct LogMessage { | 53 struct LogMessage { |
55 int severity; | 54 int severity; |
56 std::string header; | 55 std::string header; |
57 std::string message; | 56 std::string message; |
58 }; | 57 }; |
59 typedef std::vector<LogMessage> DeferredMessages; | 58 typedef std::vector<LogMessage> DeferredMessages; |
60 | 59 |
61 GpuChildThread(std::unique_ptr<gpu::GpuWatchdogThread> gpu_watchdog_thread, | 60 GpuChildThread(std::unique_ptr<gpu::GpuWatchdogThread> gpu_watchdog_thread, |
62 bool dead_on_arrival, | 61 bool dead_on_arrival, |
63 const gpu::GPUInfo& gpu_info, | 62 const gpu::GPUInfo& gpu_info, |
64 const gpu::GpuFeatureInfo& gpu_feature_info, | 63 const gpu::GpuFeatureInfo& gpu_feature_info, |
65 DeferredMessages deferred_messages, | 64 DeferredMessages deferred_messages); |
66 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory); | |
67 | 65 |
68 GpuChildThread(const InProcessChildThreadParams& params, | 66 GpuChildThread(const InProcessChildThreadParams& params, |
69 const gpu::GPUInfo& gpu_info, | 67 const gpu::GPUInfo& gpu_info, |
70 const gpu::GpuFeatureInfo& gpu_feature_info, | 68 const gpu::GpuFeatureInfo& gpu_feature_info); |
71 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory); | |
72 | 69 |
73 ~GpuChildThread() override; | 70 ~GpuChildThread() override; |
74 | 71 |
75 void Init(const base::Time& process_start_time); | 72 void Init(const base::Time& process_start_time); |
76 | 73 |
77 private: | 74 private: |
78 GpuChildThread(const ChildThreadImpl::Options& options, | 75 GpuChildThread(const ChildThreadImpl::Options& options, |
79 std::unique_ptr<gpu::GpuWatchdogThread> gpu_watchdog_thread, | 76 std::unique_ptr<gpu::GpuWatchdogThread> gpu_watchdog_thread, |
80 bool dead_on_arrival, | 77 bool dead_on_arrival, |
81 bool in_browser_process, | 78 bool in_browser_process, |
82 const gpu::GPUInfo& gpu_info, | 79 const gpu::GPUInfo& gpu_info, |
83 const gpu::GpuFeatureInfo& gpu_feature_info, | 80 const gpu::GpuFeatureInfo& gpu_feature_info); |
84 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory); | |
85 | 81 |
86 void CreateGpuMainService(ui::mojom::GpuMainAssociatedRequest request); | 82 void CreateGpuMainService(ui::mojom::GpuMainAssociatedRequest request); |
87 | 83 |
88 // ChildThreadImpl:. | 84 // ChildThreadImpl:. |
89 bool Send(IPC::Message* msg) override; | 85 bool Send(IPC::Message* msg) override; |
90 | 86 |
91 // IPC::Listener implementation via ChildThreadImpl: | 87 // IPC::Listener implementation via ChildThreadImpl: |
92 void OnAssociatedInterfaceRequest( | 88 void OnAssociatedInterfaceRequest( |
93 const std::string& name, | 89 const std::string& name, |
94 mojo::ScopedInterfaceEndpointHandle handle) override; | 90 mojo::ScopedInterfaceEndpointHandle handle) override; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 AssociatedInterfaceRegistryImpl associated_interfaces_; | 129 AssociatedInterfaceRegistryImpl associated_interfaces_; |
134 std::unique_ptr<ui::GpuService> gpu_service_; | 130 std::unique_ptr<ui::GpuService> gpu_service_; |
135 mojo::AssociatedBinding<ui::mojom::GpuMain> gpu_main_binding_; | 131 mojo::AssociatedBinding<ui::mojom::GpuMain> gpu_main_binding_; |
136 | 132 |
137 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); | 133 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
138 }; | 134 }; |
139 | 135 |
140 } // namespace content | 136 } // namespace content |
141 | 137 |
142 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ | 138 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ |
OLD | NEW |