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

Side by Side Diff: gpu/ipc/service/gpu_channel.cc

Issue 2127693002: Use ChannelMojo for GpuChannels. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-channel-gpu
Patch Set: rebase Created 4 years, 5 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 | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_channel_test_common.cc » ('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 "gpu/ipc/service/gpu_channel.h" 5 #include "gpu/ipc/service/gpu_channel.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 PreemptionFlag* preempted_flag, 584 PreemptionFlag* preempted_flag,
585 base::SingleThreadTaskRunner* task_runner, 585 base::SingleThreadTaskRunner* task_runner,
586 base::SingleThreadTaskRunner* io_task_runner, 586 base::SingleThreadTaskRunner* io_task_runner,
587 int32_t client_id, 587 int32_t client_id,
588 uint64_t client_tracing_id, 588 uint64_t client_tracing_id,
589 bool allow_view_command_buffers, 589 bool allow_view_command_buffers,
590 bool allow_real_time_streams) 590 bool allow_real_time_streams)
591 : gpu_channel_manager_(gpu_channel_manager), 591 : gpu_channel_manager_(gpu_channel_manager),
592 sync_point_manager_(sync_point_manager), 592 sync_point_manager_(sync_point_manager),
593 unhandled_message_listener_(nullptr), 593 unhandled_message_listener_(nullptr),
594 channel_id_(IPC::Channel::GenerateVerifiedChannelID("gpu")),
595 preempting_flag_(preempting_flag), 594 preempting_flag_(preempting_flag),
596 preempted_flag_(preempted_flag), 595 preempted_flag_(preempted_flag),
597 client_id_(client_id), 596 client_id_(client_id),
598 client_tracing_id_(client_tracing_id), 597 client_tracing_id_(client_tracing_id),
599 task_runner_(task_runner), 598 task_runner_(task_runner),
600 io_task_runner_(io_task_runner), 599 io_task_runner_(io_task_runner),
601 share_group_(share_group), 600 share_group_(share_group),
602 mailbox_manager_(mailbox), 601 mailbox_manager_(mailbox),
603 watchdog_(watchdog), 602 watchdog_(watchdog),
604 allow_view_command_buffers_(allow_view_command_buffers), 603 allow_view_command_buffers_(allow_view_command_buffers),
(...skipping 17 matching lines...) Expand all
622 kv.second->Disable(); 621 kv.second->Disable();
623 622
624 if (preempting_flag_.get()) 623 if (preempting_flag_.get())
625 preempting_flag_->Reset(); 624 preempting_flag_->Reset();
626 } 625 }
627 626
628 IPC::ChannelHandle GpuChannel::Init(base::WaitableEvent* shutdown_event) { 627 IPC::ChannelHandle GpuChannel::Init(base::WaitableEvent* shutdown_event) {
629 DCHECK(shutdown_event); 628 DCHECK(shutdown_event);
630 DCHECK(!channel_); 629 DCHECK(!channel_);
631 630
632 IPC::ChannelHandle channel_handle(channel_id_); 631 IPC::ChannelHandle client_handle;
632 IPC::ChannelHandle server_handle;
633 IPC::Channel::GenerateMojoChannelHandlePair(
634 "gpu", &client_handle, &server_handle);
635 channel_id_ = client_handle.name;
633 636
634 channel_ = 637 channel_ =
635 IPC::SyncChannel::Create(channel_handle, IPC::Channel::MODE_SERVER, this, 638 IPC::SyncChannel::Create(server_handle, IPC::Channel::MODE_SERVER,
636 io_task_runner_, false, shutdown_event); 639 this, io_task_runner_, false, shutdown_event);
637
638 #if defined(OS_POSIX)
639 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so
640 // that it gets closed after it has been sent.
641 base::ScopedFD renderer_fd = channel_->TakeClientFileDescriptor();
642 DCHECK(renderer_fd.is_valid());
643 channel_handle.socket = base::FileDescriptor(std::move(renderer_fd));
644 #endif
645 640
646 channel_->AddFilter(filter_.get()); 641 channel_->AddFilter(filter_.get());
647 642
648 return channel_handle; 643 return client_handle;
649 } 644 }
650 645
651 void GpuChannel::SetUnhandledMessageListener(IPC::Listener* listener) { 646 void GpuChannel::SetUnhandledMessageListener(IPC::Listener* listener) {
652 unhandled_message_listener_ = listener; 647 unhandled_message_listener_ = listener;
653 } 648 }
654 649
655 base::WeakPtr<GpuChannel> GpuChannel::AsWeakPtr() { 650 base::WeakPtr<GpuChannel> GpuChannel::AsWeakPtr() {
656 return weak_factory_.GetWeakPtr(); 651 return weak_factory_.GetWeakPtr();
657 } 652 }
658 653
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1062
1068 return manager->gpu_memory_buffer_factory() 1063 return manager->gpu_memory_buffer_factory()
1069 ->AsImageFactory() 1064 ->AsImageFactory()
1070 ->CreateImageForGpuMemoryBuffer(handle, size, format, internalformat, 1065 ->CreateImageForGpuMemoryBuffer(handle, size, format, internalformat,
1071 client_id_, surface_handle); 1066 client_id_, surface_handle);
1072 } 1067 }
1073 } 1068 }
1074 } 1069 }
1075 1070
1076 } // namespace gpu 1071 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_channel.h ('k') | gpu/ipc/service/gpu_channel_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698