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

Side by Side Diff: content/gpu/gpu_child_thread.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 | « content/gpu/gpu_child_thread.h ('k') | services/ui/gpu/DEPS » ('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 (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 #include "content/gpu/gpu_child_thread.h" 5 #include "content/gpu/gpu_child_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "ui/gl/init/gl_factory.h" 46 #include "ui/gl/init/gl_factory.h"
47 #include "url/gurl.h" 47 #include "url/gurl.h"
48 48
49 #if defined(USE_OZONE) 49 #if defined(USE_OZONE)
50 #include "ui/ozone/public/ozone_platform.h" 50 #include "ui/ozone/public/ozone_platform.h"
51 #endif 51 #endif
52 52
53 #if defined(OS_ANDROID) 53 #if defined(OS_ANDROID)
54 #include "base/android/throw_uncaught_exception.h" 54 #include "base/android/throw_uncaught_exception.h"
55 #include "media/base/android/media_client_android.h" 55 #include "media/base/android/media_client_android.h"
56 #include "media/gpu/avda_codec_allocator.h"
57 #endif 56 #endif
58 57
59 namespace content { 58 namespace content {
60 namespace { 59 namespace {
61 60
62 static base::LazyInstance<scoped_refptr<ThreadSafeSender> > 61 static base::LazyInstance<scoped_refptr<ThreadSafeSender> >
63 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER; 62 g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER;
64 63
65 bool GpuProcessLogMessageHandler(int severity, 64 bool GpuProcessLogMessageHandler(int severity,
66 const char* file, int line, 65 const char* file, int line,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 261
263 return handled; 262 return handled;
264 } 263 }
265 264
266 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { 265 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) {
267 if (ChildThreadImpl::OnMessageReceived(msg)) 266 if (ChildThreadImpl::OnMessageReceived(msg))
268 return true; 267 return true;
269 268
270 bool handled = true; 269 bool handled = true;
271 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) 270 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg)
272 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel)
273 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) 271 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer)
274 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader)
275 #if defined(OS_ANDROID)
276 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu);
277 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface,
278 OnDestroyingVideoSurface);
279 #endif
280 IPC_MESSAGE_UNHANDLED(handled = false) 272 IPC_MESSAGE_UNHANDLED(handled = false)
281 IPC_END_MESSAGE_MAP() 273 IPC_END_MESSAGE_MAP()
282 if (handled) 274 if (handled)
283 return true; 275 return true;
284 276
285 return false; 277 return false;
286 } 278 }
287 279
288 void GpuChildThread::OnAssociatedInterfaceRequest( 280 void GpuChildThread::OnAssociatedInterfaceRequest(
289 const std::string& name, 281 const std::string& name,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 440 }
449 #endif 441 #endif
450 442
451 void GpuChildThread::OnGpuSwitched() { 443 void GpuChildThread::OnGpuSwitched() {
452 DVLOG(1) << "GPU: GPU has switched"; 444 DVLOG(1) << "GPU: GPU has switched";
453 // Notify observers in the GPU process. 445 // Notify observers in the GPU process.
454 if (!in_browser_process_) 446 if (!in_browser_process_)
455 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 447 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
456 } 448 }
457 449
458 void GpuChildThread::OnCloseChannel(int32_t client_id) {
459 if (gpu_channel_manager())
460 gpu_channel_manager()->RemoveChannel(client_id);
461 }
462
463 void GpuChildThread::OnLoadedShader(const std::string& shader) {
464 if (gpu_channel_manager())
465 gpu_channel_manager()->PopulateShaderCache(shader);
466 }
467
468 void GpuChildThread::OnDestroyGpuMemoryBuffer( 450 void GpuChildThread::OnDestroyGpuMemoryBuffer(
469 gfx::GpuMemoryBufferId id, 451 gfx::GpuMemoryBufferId id,
470 int client_id, 452 int client_id,
471 const gpu::SyncToken& sync_token) { 453 const gpu::SyncToken& sync_token) {
472 if (gpu_channel_manager()) 454 if (gpu_channel_manager())
473 gpu_channel_manager()->DestroyGpuMemoryBuffer(id, client_id, sync_token); 455 gpu_channel_manager()->DestroyGpuMemoryBuffer(id, client_id, sync_token);
474 } 456 }
475 457
476 #if defined(OS_ANDROID)
477 void GpuChildThread::OnWakeUpGpu() {
478 if (gpu_channel_manager())
479 gpu_channel_manager()->WakeUpGpu();
480 }
481
482 void GpuChildThread::OnDestroyingVideoSurface(int surface_id) {
483 media::AVDACodecAllocator::Instance()->OnSurfaceDestroyed(surface_id);
484 Send(new GpuHostMsg_DestroyingVideoSurfaceAck(surface_id));
485 }
486 #endif
487
488 void GpuChildThread::BindServiceFactoryRequest( 458 void GpuChildThread::BindServiceFactoryRequest(
489 service_manager::mojom::ServiceFactoryRequest request) { 459 service_manager::mojom::ServiceFactoryRequest request) {
490 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; 460 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
491 DCHECK(service_factory_); 461 DCHECK(service_factory_);
492 service_factory_bindings_.AddBinding(service_factory_.get(), 462 service_factory_bindings_.AddBinding(service_factory_.get(),
493 std::move(request)); 463 std::move(request));
494 } 464 }
495 465
496 } // namespace content 466 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | services/ui/gpu/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698