Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: services/ui/gpu/gpu_service_internal.h

Issue 2366623002: services/ui: Initialize all of gpu in one thread. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ 6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
11 #include "base/threading/thread.h"
12 #include "build/build_config.h" 11 #include "build/build_config.h"
13 #include "gpu/command_buffer/service/gpu_preferences.h" 12 #include "gpu/command_buffer/service/gpu_preferences.h"
14 #include "gpu/config/gpu_info.h" 13 #include "gpu/config/gpu_info.h"
15 #include "gpu/ipc/common/surface_handle.h" 14 #include "gpu/ipc/common/surface_handle.h"
16 #include "gpu/ipc/service/gpu_channel.h" 15 #include "gpu/ipc/service/gpu_channel.h"
17 #include "gpu/ipc/service/gpu_channel_manager.h" 16 #include "gpu/ipc/service/gpu_channel_manager.h"
18 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" 17 #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
19 #include "gpu/ipc/service/gpu_config.h" 18 #include "gpu/ipc/service/gpu_config.h"
20 #include "gpu/ipc/service/x_util.h" 19 #include "gpu/ipc/service/x_util.h"
21 #include "mojo/public/cpp/bindings/binding.h" 20 #include "mojo/public/cpp/bindings/binding.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 gpu::SurfaceHandle surface_handle); 57 gpu::SurfaceHandle surface_handle);
59 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 58 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
60 int client_id, 59 int client_id,
61 const gpu::SyncToken& sync_token); 60 const gpu::SyncToken& sync_token);
62 61
63 private: 62 private:
64 friend class GpuMain; 63 friend class GpuMain;
65 64
66 GpuServiceInternal(const gpu::GPUInfo& gpu_info, 65 GpuServiceInternal(const gpu::GPUInfo& gpu_info,
67 gpu::GpuWatchdogThread* watchdog, 66 gpu::GpuWatchdogThread* watchdog,
68 gpu::GpuMemoryBufferFactory* memory_buffer_factory); 67 gpu::GpuMemoryBufferFactory* memory_buffer_factory,
69 68 scoped_refptr<base::SingleThreadTaskRunner> io_runner);
70 void BindOnGpuThread(mojom::GpuServiceInternalRequest request);
71 void TearDownGpuThread();
72 69
73 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( 70 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle(
74 gfx::GpuMemoryBufferHandle buffer_handle, 71 gfx::GpuMemoryBufferHandle buffer_handle,
75 gfx::GpuMemoryBufferId id, 72 gfx::GpuMemoryBufferId id,
76 const gfx::Size& size, 73 const gfx::Size& size,
77 gfx::BufferFormat format, 74 gfx::BufferFormat format,
78 int client_id); 75 int client_id);
79 76
80 // gpu::GpuChannelManagerDelegate: 77 // gpu::GpuChannelManagerDelegate:
81 void DidCreateOffscreenContext(const GURL& active_url) override; 78 void DidCreateOffscreenContext(const GURL& active_url) override;
(...skipping 13 matching lines...) Expand all
95 void SetActiveURL(const GURL& url) override; 92 void SetActiveURL(const GURL& url) override;
96 93
97 // mojom::GpuServiceInternal: 94 // mojom::GpuServiceInternal:
98 void Initialize(const InitializeCallback& callback) override; 95 void Initialize(const InitializeCallback& callback) override;
99 void EstablishGpuChannel( 96 void EstablishGpuChannel(
100 int32_t client_id, 97 int32_t client_id,
101 uint64_t client_tracing_id, 98 uint64_t client_tracing_id,
102 bool is_gpu_host, 99 bool is_gpu_host,
103 const EstablishGpuChannelCallback& callback) override; 100 const EstablishGpuChannelCallback& callback) override;
104 101
105 // The main thread task runner. 102 scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
106 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
107 103
108 // An event that will be signalled when we shutdown. 104 // An event that will be signalled when we shutdown.
109 base::WaitableEvent shutdown_event_; 105 base::WaitableEvent shutdown_event_;
110 106
111 // The main thread for GpuService.
112 base::Thread gpu_thread_;
113
114 // The thread that handles IO events for GpuService.
115 base::Thread io_thread_;
116
117 gpu::GpuWatchdogThread* watchdog_thread_; 107 gpu::GpuWatchdogThread* watchdog_thread_;
118 108
119 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; 109 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_;
120 110
121 gpu::GpuPreferences gpu_preferences_; 111 gpu::GpuPreferences gpu_preferences_;
122 112
123 // Information about the GPU, such as device and vendor ID. 113 // Information about the GPU, such as device and vendor ID.
124 gpu::GPUInfo gpu_info_; 114 gpu::GPUInfo gpu_info_;
125 115
126 // All of the following are created, used, and destroyed in the gpu thread.
127 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; 116 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_;
128 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; 117 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
129 std::unique_ptr<media::MediaService> media_service_; 118 std::unique_ptr<media::MediaService> media_service_;
130 mojo::Binding<mojom::GpuServiceInternal> binding_; 119 mojo::Binding<mojom::GpuServiceInternal> binding_;
131 120
132 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); 121 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal);
133 }; 122 };
134 123
135 } // namespace ui 124 } // namespace ui
136 125
137 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ 126 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698