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

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 2696473002: gpu: Use mojom API for creating gpu channel. (Closed)
Patch Set: . Created 3 years, 10 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 (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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 return handled; 265 return handled;
266 } 266 }
267 267
268 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { 268 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) {
269 if (ChildThreadImpl::OnMessageReceived(msg)) 269 if (ChildThreadImpl::OnMessageReceived(msg))
270 return true; 270 return true;
271 271
272 bool handled = true; 272 bool handled = true;
273 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) 273 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg)
274 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel)
275 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) 274 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel)
276 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) 275 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer)
277 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) 276 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader)
278 #if defined(OS_ANDROID) 277 #if defined(OS_ANDROID)
279 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu); 278 IPC_MESSAGE_HANDLER(GpuMsg_WakeUpGpu, OnWakeUpGpu);
280 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface, 279 IPC_MESSAGE_HANDLER(GpuMsg_DestroyingVideoSurface,
281 OnDestroyingVideoSurface); 280 OnDestroyingVideoSurface);
282 #endif 281 #endif
283 IPC_MESSAGE_UNHANDLED(handled = false) 282 IPC_MESSAGE_UNHANDLED(handled = false)
284 IPC_END_MESSAGE_MAP() 283 IPC_END_MESSAGE_MAP()
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 458 }
460 #endif 459 #endif
461 460
462 void GpuChildThread::OnGpuSwitched() { 461 void GpuChildThread::OnGpuSwitched() {
463 DVLOG(1) << "GPU: GPU has switched"; 462 DVLOG(1) << "GPU: GPU has switched";
464 // Notify observers in the GPU process. 463 // Notify observers in the GPU process.
465 if (!in_browser_process_) 464 if (!in_browser_process_)
466 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 465 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
467 } 466 }
468 467
469 void GpuChildThread::OnEstablishChannel(const EstablishChannelParams& params) {
470 if (!gpu_channel_manager())
471 return;
472
473 IPC::ChannelHandle channel_handle = gpu_channel_manager()->EstablishChannel(
474 params.client_id, params.client_tracing_id, params.preempts,
475 params.allow_view_command_buffers, params.allow_real_time_streams);
476 gpu_service_->media_gpu_channel_manager()->AddChannel(params.client_id);
477 Send(new GpuHostMsg_ChannelEstablished(channel_handle));
478 }
479
480 void GpuChildThread::OnCloseChannel(int32_t client_id) { 468 void GpuChildThread::OnCloseChannel(int32_t client_id) {
481 if (gpu_channel_manager()) 469 if (gpu_channel_manager())
482 gpu_channel_manager()->RemoveChannel(client_id); 470 gpu_channel_manager()->RemoveChannel(client_id);
483 } 471 }
484 472
485 void GpuChildThread::OnLoadedShader(const std::string& shader) { 473 void GpuChildThread::OnLoadedShader(const std::string& shader) {
486 if (gpu_channel_manager()) 474 if (gpu_channel_manager())
487 gpu_channel_manager()->PopulateShaderCache(shader); 475 gpu_channel_manager()->PopulateShaderCache(shader);
488 } 476 }
489 477
(...skipping 19 matching lines...) Expand all
509 497
510 void GpuChildThread::BindServiceFactoryRequest( 498 void GpuChildThread::BindServiceFactoryRequest(
511 service_manager::mojom::ServiceFactoryRequest request) { 499 service_manager::mojom::ServiceFactoryRequest request) {
512 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; 500 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
513 DCHECK(service_factory_); 501 DCHECK(service_factory_);
514 service_factory_bindings_.AddBinding(service_factory_.get(), 502 service_factory_bindings_.AddBinding(service_factory_.get(),
515 std::move(request)); 503 std::move(request));
516 } 504 }
517 505
518 } // namespace content 506 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698