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

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

Issue 2723163002: gpu: Replace more chrome ipc with mojom api. (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') | services/ui/gpu/interfaces/gpu_service.mojom » ('j') | 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 17 matching lines...) Expand all
28 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" 28 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
29 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" 29 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
30 #include "media/gpu/ipc/service/media_gpu_channel_manager.h" 30 #include "media/gpu/ipc/service/media_gpu_channel_manager.h"
31 #include "mojo/public/cpp/bindings/strong_binding.h" 31 #include "mojo/public/cpp/bindings/strong_binding.h"
32 #include "ui/gl/gl_implementation.h" 32 #include "ui/gl/gl_implementation.h"
33 #include "ui/gl/gl_switches.h" 33 #include "ui/gl/gl_switches.h"
34 #include "ui/gl/gpu_switching_manager.h" 34 #include "ui/gl/gpu_switching_manager.h"
35 #include "ui/gl/init/gl_factory.h" 35 #include "ui/gl/init/gl_factory.h"
36 #include "url/gurl.h" 36 #include "url/gurl.h"
37 37
38 #if defined(OS_ANDROID)
39 #include "media/gpu/avda_codec_allocator.h"
40 #endif
41
38 namespace ui { 42 namespace ui {
39 43
40 GpuService::GpuService(const gpu::GPUInfo& gpu_info, 44 GpuService::GpuService(const gpu::GPUInfo& gpu_info,
41 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, 45 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread,
42 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, 46 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
43 scoped_refptr<base::SingleThreadTaskRunner> io_runner, 47 scoped_refptr<base::SingleThreadTaskRunner> io_runner,
44 const gpu::GpuFeatureInfo& gpu_feature_info) 48 const gpu::GpuFeatureInfo& gpu_feature_info)
45 : io_runner_(std::move(io_runner)), 49 : io_runner_(std::move(io_runner)),
46 shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, 50 shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
47 base::WaitableEvent::InitialState::NOT_SIGNALED), 51 base::WaitableEvent::InitialState::NOT_SIGNALED),
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 const bool allow_real_time_streams = is_gpu_host; 196 const bool allow_real_time_streams = is_gpu_host;
193 mojo::ScopedMessagePipeHandle channel_handle; 197 mojo::ScopedMessagePipeHandle channel_handle;
194 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( 198 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel(
195 client_id, client_tracing_id, preempts, allow_view_command_buffers, 199 client_id, client_tracing_id, preempts, allow_view_command_buffers,
196 allow_real_time_streams); 200 allow_real_time_streams);
197 channel_handle.reset(handle.mojo_handle); 201 channel_handle.reset(handle.mojo_handle);
198 media_gpu_channel_manager_->AddChannel(client_id); 202 media_gpu_channel_manager_->AddChannel(client_id);
199 callback.Run(std::move(channel_handle)); 203 callback.Run(std::move(channel_handle));
200 } 204 }
201 205
206 void GpuService::CloseChannel(int32_t client_id) {
207 if (!gpu_channel_manager_)
208 return;
209 gpu_channel_manager_->RemoveChannel(client_id);
210 }
211
212 void GpuService::LoadedShader(const std::string& data) {
213 if (!gpu_channel_manager_)
214 return;
215 gpu_channel_manager_->PopulateShaderCache(data);
216 }
217
218 void GpuService::DestroyingVideoSurface(
219 int32_t surface_id,
220 const DestroyingVideoSurfaceCallback& callback) {
221 #if defined(OS_ANDROID)
222 media::AVDACodecAllocator::Instance()->OnSurfaceDestroyed(surface_id);
223 #else
224 NOTREACHED() << "DestroyingVideoSurface() not supported on this platform.";
225 #endif
226 callback.Run();
227 }
228
229 void GpuService::WakeUpGpu() {
230 #if defined(OS_ANDROID)
231 if (!gpu_channel_manager_)
232 return;
233 gpu_channel_manager_->WakeUpGpu();
234 #else
235 NOTREACHED() << "WakeUpGpu() not supported on this platform.";
236 #endif
237 }
238
202 } // namespace ui 239 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | services/ui/gpu/interfaces/gpu_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698