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

Side by Side Diff: services/ui/gpu/gpu_service.cc

Issue 2764753004: mus-gpu: Talk to the GpuHost from the IO thread. (Closed)
Patch Set: . Created 3 years, 9 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
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "services/ui/gpu/gpu_service.h" 5 #include "services/ui/gpu/gpu_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 shutdown_event_.Signal(); 69 shutdown_event_.Signal();
70 } 70 }
71 71
72 void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host, 72 void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host,
73 const gpu::GpuPreferences& preferences, 73 const gpu::GpuPreferences& preferences,
74 gpu::GpuProcessActivityFlags activity_flags, 74 gpu::GpuProcessActivityFlags activity_flags,
75 gpu::SyncPointManager* sync_point_manager, 75 gpu::SyncPointManager* sync_point_manager,
76 base::WaitableEvent* shutdown_event) { 76 base::WaitableEvent* shutdown_event) {
77 DCHECK(CalledOnValidThread()); 77 DCHECK(CalledOnValidThread());
78 DCHECK(!gpu_host_); 78 DCHECK(!gpu_host_);
79 gpu_host_ = std::move(gpu_host);
80 gpu_preferences_ = preferences; 79 gpu_preferences_ = preferences;
81 gpu_info_.video_decode_accelerator_capabilities = 80 gpu_info_.video_decode_accelerator_capabilities =
82 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); 81 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_);
83 gpu_info_.video_encode_accelerator_supported_profiles = 82 gpu_info_.video_encode_accelerator_supported_profiles =
84 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_); 83 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_);
85 gpu_info_.jpeg_decode_accelerator_supported = 84 gpu_info_.jpeg_decode_accelerator_supported =
86 media::GpuJpegDecodeAcceleratorFactoryProvider:: 85 media::GpuJpegDecodeAcceleratorFactoryProvider::
87 IsAcceleratedJpegDecodeSupported(); 86 IsAcceleratedJpegDecodeSupported();
88 gpu_host_->DidInitialize(gpu_info_); 87 gpu_host->DidInitialize(gpu_info_);
89 88 gpu_host_ =
89 mojom::ThreadSafeGpuHostPtr::Create(gpu_host.PassInterface(), io_runner_);
90 sync_point_manager_ = sync_point_manager; 90 sync_point_manager_ = sync_point_manager;
91 if (!sync_point_manager_) { 91 if (!sync_point_manager_) {
92 owned_sync_point_manager_ = base::MakeUnique<gpu::SyncPointManager>(); 92 owned_sync_point_manager_ = base::MakeUnique<gpu::SyncPointManager>();
93 sync_point_manager_ = owned_sync_point_manager_.get(); 93 sync_point_manager_ = owned_sync_point_manager_.get();
94 } 94 }
95 95
96 // Defer creation of the render thread. This is to prevent it from handling 96 // Defer creation of the render thread. This is to prevent it from handling
97 // IPC messages before the sandbox has been enabled and all other necessary 97 // IPC messages before the sandbox has been enabled and all other necessary
98 // initialization has succeeded. 98 // initialization has succeeded.
99 gpu_channel_manager_.reset(new gpu::GpuChannelManager( 99 gpu_channel_manager_.reset(new gpu::GpuChannelManager(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 const GetVideoMemoryUsageStatsCallback& callback) { 136 const GetVideoMemoryUsageStatsCallback& callback) {
137 gpu::VideoMemoryUsageStats video_memory_usage_stats; 137 gpu::VideoMemoryUsageStats video_memory_usage_stats;
138 if (gpu_channel_manager_) { 138 if (gpu_channel_manager_) {
139 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( 139 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats(
140 &video_memory_usage_stats); 140 &video_memory_usage_stats);
141 } 141 }
142 callback.Run(video_memory_usage_stats); 142 callback.Run(video_memory_usage_stats);
143 } 143 }
144 144
145 void GpuService::DidCreateOffscreenContext(const GURL& active_url) { 145 void GpuService::DidCreateOffscreenContext(const GURL& active_url) {
146 gpu_host_->DidCreateOffscreenContext(active_url); 146 (*gpu_host_)->DidCreateOffscreenContext(active_url);
147 } 147 }
148 148
149 void GpuService::DidDestroyChannel(int client_id) { 149 void GpuService::DidDestroyChannel(int client_id) {
150 media_gpu_channel_manager_->RemoveChannel(client_id); 150 media_gpu_channel_manager_->RemoveChannel(client_id);
151 gpu_host_->DidDestroyChannel(client_id); 151 (*gpu_host_)->DidDestroyChannel(client_id);
152 } 152 }
153 153
154 void GpuService::DidDestroyOffscreenContext(const GURL& active_url) { 154 void GpuService::DidDestroyOffscreenContext(const GURL& active_url) {
155 gpu_host_->DidDestroyOffscreenContext(active_url); 155 (*gpu_host_)->DidDestroyOffscreenContext(active_url);
156 } 156 }
157 157
158 void GpuService::DidLoseContext(bool offscreen, 158 void GpuService::DidLoseContext(bool offscreen,
159 gpu::error::ContextLostReason reason, 159 gpu::error::ContextLostReason reason,
160 const GURL& active_url) { 160 const GURL& active_url) {
161 gpu_host_->DidLoseContext(offscreen, reason, active_url); 161 (*gpu_host_)->DidLoseContext(offscreen, reason, active_url);
162 } 162 }
163 163
164 void GpuService::StoreShaderToDisk(int client_id, 164 void GpuService::StoreShaderToDisk(int client_id,
165 const std::string& key, 165 const std::string& key,
166 const std::string& shader) { 166 const std::string& shader) {
167 gpu_host_->StoreShaderToDisk(client_id, key, shader); 167 (*gpu_host_)->StoreShaderToDisk(client_id, key, shader);
168 } 168 }
169 169
170 #if defined(OS_WIN) 170 #if defined(OS_WIN)
171 void GpuService::SendAcceleratedSurfaceCreatedChildWindow( 171 void GpuService::SendAcceleratedSurfaceCreatedChildWindow(
172 gpu::SurfaceHandle parent_window, 172 gpu::SurfaceHandle parent_window,
173 gpu::SurfaceHandle child_window) { 173 gpu::SurfaceHandle child_window) {
174 gpu_host_->SetChildSurface(parent_window, child_window); 174 (*gpu_host_)->SetChildSurface(parent_window, child_window);
175 } 175 }
176 #endif 176 #endif
177 177
178 void GpuService::SetActiveURL(const GURL& url) { 178 void GpuService::SetActiveURL(const GURL& url) {
179 constexpr char kActiveURL[] = "url-chunk"; 179 constexpr char kActiveURL[] = "url-chunk";
180 base::debug::SetCrashKeyValue(kActiveURL, url.possibly_invalid_spec()); 180 base::debug::SetCrashKeyValue(kActiveURL, url.possibly_invalid_spec());
181 } 181 }
182 182
183 void GpuService::EstablishGpuChannel( 183 void GpuService::EstablishGpuChannel(
184 int32_t client_id, 184 int32_t client_id,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 NOTREACHED() << "Java exception not supported on this platform."; 266 NOTREACHED() << "Java exception not supported on this platform.";
267 #endif 267 #endif
268 } 268 }
269 269
270 void GpuService::Stop(const StopCallback& callback) { 270 void GpuService::Stop(const StopCallback& callback) {
271 base::MessageLoop::current()->QuitWhenIdle(); 271 base::MessageLoop::current()->QuitWhenIdle();
272 callback.Run(); 272 callback.Run();
273 } 273 }
274 274
275 } // namespace ui 275 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698