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 <queue> | 10 #include <queue> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // The main thread of the GPU child process. There will only ever be one of | 50 // The main thread of the GPU child process. There will only ever be one of |
51 // these per process. It does process initialization and shutdown. It forwards | 51 // these per process. It does process initialization and shutdown. It forwards |
52 // IPC messages to GpuChannelManager, which is responsible for issuing rendering | 52 // IPC messages to GpuChannelManager, which is responsible for issuing rendering |
53 // commands to the GPU. | 53 // commands to the GPU. |
54 class GpuChildThread : public ChildThreadImpl, | 54 class GpuChildThread : public ChildThreadImpl, |
55 public GpuChannelManagerDelegate { | 55 public GpuChannelManagerDelegate { |
56 public: | 56 public: |
57 typedef std::queue<IPC::Message*> DeferredMessages; | 57 typedef std::queue<IPC::Message*> DeferredMessages; |
58 | 58 |
| 59 // Returns the one gpu thread for this process. Note that this can only |
| 60 // be accessed when running on the gpu thread itself. |
| 61 static GpuChildThread* current(); |
| 62 |
59 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, | 63 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, |
60 bool dead_on_arrival, | 64 bool dead_on_arrival, |
61 const gpu::GPUInfo& gpu_info, | 65 const gpu::GPUInfo& gpu_info, |
62 const DeferredMessages& deferred_messages, | 66 const DeferredMessages& deferred_messages, |
63 GpuMemoryBufferFactory* gpu_memory_buffer_factory, | 67 GpuMemoryBufferFactory* gpu_memory_buffer_factory, |
64 gpu::SyncPointManager* sync_point_manager); | 68 gpu::SyncPointManager* sync_point_manager); |
65 | 69 |
66 GpuChildThread(const gpu::GpuPreferences& gpu_preferences, | 70 GpuChildThread(const gpu::GpuPreferences& gpu_preferences, |
67 const InProcessChildThreadParams& params, | 71 const InProcessChildThreadParams& params, |
68 GpuMemoryBufferFactory* gpu_memory_buffer_factory, | 72 GpuMemoryBufferFactory* gpu_memory_buffer_factory, |
69 gpu::SyncPointManager* sync_point_manager); | 73 gpu::SyncPointManager* sync_point_manager); |
70 | 74 |
71 ~GpuChildThread() override; | 75 ~GpuChildThread() override; |
72 | 76 |
73 void Shutdown() override; | 77 void Shutdown() override; |
74 | 78 |
75 void Init(const base::Time& process_start_time); | 79 void Init(const base::Time& process_start_time); |
76 void StopWatchdog(); | 80 void StopWatchdog(); |
77 | 81 |
| 82 gpu::GpuPreferences gpu_preferences() { return gpu_preferences_; } |
| 83 |
78 private: | 84 private: |
79 // ChildThread overrides. | 85 // ChildThread overrides. |
80 bool Send(IPC::Message* msg) override; | 86 bool Send(IPC::Message* msg) override; |
81 bool OnControlMessageReceived(const IPC::Message& msg) override; | 87 bool OnControlMessageReceived(const IPC::Message& msg) override; |
82 bool OnMessageReceived(const IPC::Message& msg) override; | 88 bool OnMessageReceived(const IPC::Message& msg) override; |
83 | 89 |
84 // GpuChannelManagerDelegate implementation. | 90 // GpuChannelManagerDelegate implementation. |
85 void SetActiveURL(const GURL& url) override; | 91 void SetActiveURL(const GURL& url) override; |
86 void AddSubscription(int32_t client_id, unsigned int target) override; | 92 void AddSubscription(int32_t client_id, unsigned int target) override; |
87 void DidCreateOffscreenContext(const GURL& active_url) override; | 93 void DidCreateOffscreenContext(const GURL& active_url) override; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 186 |
181 // Bindings to the mojom::ProcessControl impl. | 187 // Bindings to the mojom::ProcessControl impl. |
182 mojo::BindingSet<mojom::ProcessControl> process_control_bindings_; | 188 mojo::BindingSet<mojom::ProcessControl> process_control_bindings_; |
183 | 189 |
184 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); | 190 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
185 }; | 191 }; |
186 | 192 |
187 } // namespace content | 193 } // namespace content |
188 | 194 |
189 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ | 195 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ |
OLD | NEW |