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

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

Issue 2038423004: Use ChannelMojo for Browser-GPU and Renderer-GPU IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-utility-channel-mojo
Patch Set: fix pepper Created 4 years, 6 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/DEPS ('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 (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 23 matching lines...) Expand all
34 #include "gpu/command_buffer/service/command_executor.h" 34 #include "gpu/command_buffer/service/command_executor.h"
35 #include "gpu/command_buffer/service/image_factory.h" 35 #include "gpu/command_buffer/service/image_factory.h"
36 #include "gpu/command_buffer/service/mailbox_manager.h" 36 #include "gpu/command_buffer/service/mailbox_manager.h"
37 #include "gpu/command_buffer/service/sync_point_manager.h" 37 #include "gpu/command_buffer/service/sync_point_manager.h"
38 #include "gpu/ipc/common/gpu_messages.h" 38 #include "gpu/ipc/common/gpu_messages.h"
39 #include "gpu/ipc/service/gpu_channel_manager.h" 39 #include "gpu/ipc/service/gpu_channel_manager.h"
40 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" 40 #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
41 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" 41 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
42 #include "ipc/ipc_channel.h" 42 #include "ipc/ipc_channel.h"
43 #include "ipc/message_filter.h" 43 #include "ipc/message_filter.h"
44 #include "mojo/public/cpp/system/message_pipe.h"
44 #include "ui/gl/gl_context.h" 45 #include "ui/gl/gl_context.h"
45 #include "ui/gl/gl_image_shared_memory.h" 46 #include "ui/gl/gl_image_shared_memory.h"
46 #include "ui/gl/gl_surface.h" 47 #include "ui/gl/gl_surface.h"
47 48
48 #if defined(OS_POSIX) 49 #if defined(OS_POSIX)
49 #include "ipc/ipc_channel_posix.h" 50 #include "ipc/ipc_channel_posix.h"
50 #endif 51 #endif
51 52
52 namespace gpu { 53 namespace gpu {
53 namespace { 54 namespace {
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 624
624 if (preempting_flag_.get()) 625 if (preempting_flag_.get())
625 preempting_flag_->Reset(); 626 preempting_flag_->Reset();
626 } 627 }
627 628
628 IPC::ChannelHandle GpuChannel::Init(base::WaitableEvent* shutdown_event) { 629 IPC::ChannelHandle GpuChannel::Init(base::WaitableEvent* shutdown_event) {
629 DCHECK(shutdown_event); 630 DCHECK(shutdown_event);
630 DCHECK(!channel_); 631 DCHECK(!channel_);
631 632
632 IPC::ChannelHandle channel_handle(channel_id_); 633 IPC::ChannelHandle channel_handle(channel_id_);
634 IPC::ChannelHandle client_channel_handle = channel_handle;
635 mojo::MessagePipe pipe_pair;
636 DCHECK(pipe_pair.handle0.is_valid());
637 DCHECK(pipe_pair.handle1.is_valid());
638 channel_handle = IPC::ChannelHandle(pipe_pair.handle0.release());
639 client_channel_handle = IPC::ChannelHandle(pipe_pair.handle1.release());
633 640
634 channel_ = 641 channel_ =
635 IPC::SyncChannel::Create(channel_handle, IPC::Channel::MODE_SERVER, this, 642 IPC::SyncChannel::Create(channel_handle, IPC::Channel::MODE_SERVER,
636 io_task_runner_, false, shutdown_event); 643 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 644
646 channel_->AddFilter(filter_.get()); 645 channel_->AddFilter(filter_.get());
647 646
648 return channel_handle; 647 return client_channel_handle;
649 } 648 }
650 649
651 void GpuChannel::SetUnhandledMessageListener(IPC::Listener* listener) { 650 void GpuChannel::SetUnhandledMessageListener(IPC::Listener* listener) {
652 unhandled_message_listener_ = listener; 651 unhandled_message_listener_ = listener;
653 } 652 }
654 653
655 base::WeakPtr<GpuChannel> GpuChannel::AsWeakPtr() { 654 base::WeakPtr<GpuChannel> GpuChannel::AsWeakPtr() {
656 return weak_factory_.GetWeakPtr(); 655 return weak_factory_.GetWeakPtr();
657 } 656 }
658 657
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 ->CreateImageForGpuMemoryBuffer(handle, 1068 ->CreateImageForGpuMemoryBuffer(handle,
1070 size, 1069 size,
1071 format, 1070 format,
1072 internalformat, 1071 internalformat,
1073 client_id_); 1072 client_id_);
1074 } 1073 }
1075 } 1074 }
1076 } 1075 }
1077 1076
1078 } // namespace gpu 1077 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698