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

Side by Side Diff: ipc/ipc_channel_posix.cc

Issue 2821028: Up the warnings in ipc (take 2)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 "ipc/ipc_channel_posix.h" 5 #include "ipc/ipc_channel_posix.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 void *iter = NULL; 692 void *iter = NULL;
693 int pid; 693 int pid;
694 if (!m.ReadInt(&iter, &pid)) { 694 if (!m.ReadInt(&iter, &pid)) {
695 NOTREACHED(); 695 NOTREACHED();
696 } 696 }
697 #if !defined(OS_MACOSX) 697 #if !defined(OS_MACOSX)
698 if (mode_ == MODE_SERVER && !uses_fifo_) { 698 if (mode_ == MODE_SERVER && !uses_fifo_) {
699 // On non-Mac, the Hello message from the client to the server 699 // On non-Mac, the Hello message from the client to the server
700 // also contains the fd_pipe_, which will be used for all 700 // also contains the fd_pipe_, which will be used for all
701 // subsequent file descriptor passing. 701 // subsequent file descriptor passing.
702 DCHECK_EQ(m.file_descriptor_set()->size(), 1); 702 DCHECK_EQ(m.file_descriptor_set()->size(), 1U);
703 base::FileDescriptor descriptor; 703 base::FileDescriptor descriptor;
704 if (!m.ReadFileDescriptor(&iter, &descriptor)) { 704 if (!m.ReadFileDescriptor(&iter, &descriptor)) {
705 NOTREACHED(); 705 NOTREACHED();
706 } 706 }
707 fd_pipe_ = descriptor.fd; 707 fd_pipe_ = descriptor.fd;
708 CHECK(descriptor.auto_close); 708 CHECK(descriptor.auto_close);
709 } 709 }
710 #endif 710 #endif
711 listener_->OnChannelConnected(pid); 711 listener_->OnChannelConnected(pid);
712 } else { 712 } else {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 if (!msg->ReadInt(&iter, &pid) || 770 if (!msg->ReadInt(&iter, &pid) ||
771 !hello->WriteInt(pid)) { 771 !hello->WriteInt(pid)) {
772 NOTREACHED(); 772 NOTREACHED();
773 } 773 }
774 DCHECK_EQ(hello->size(), msg->size()); 774 DCHECK_EQ(hello->size(), msg->size());
775 if (!hello->WriteFileDescriptor(base::FileDescriptor(remote_fd_pipe_, 775 if (!hello->WriteFileDescriptor(base::FileDescriptor(remote_fd_pipe_,
776 false))) { 776 false))) {
777 NOTREACHED(); 777 NOTREACHED();
778 } 778 }
779 msg = hello.get(); 779 msg = hello.get();
780 DCHECK_EQ(msg->file_descriptor_set()->size(), 1); 780 DCHECK_EQ(msg->file_descriptor_set()->size(), 1U);
781 } 781 }
782 #endif 782 #endif
783 783
784 size_t amt_to_write = msg->size() - message_send_bytes_written_; 784 size_t amt_to_write = msg->size() - message_send_bytes_written_;
785 DCHECK(amt_to_write != 0); 785 DCHECK(amt_to_write != 0);
786 const char* out_bytes = reinterpret_cast<const char*>(msg->data()) + 786 const char* out_bytes = reinterpret_cast<const char*>(msg->data()) +
787 message_send_bytes_written_; 787 message_send_bytes_written_;
788 788
789 struct msghdr msgh = {0}; 789 struct msghdr msgh = {0};
790 struct iovec iov = {const_cast<char*>(out_bytes), amt_to_write}; 790 struct iovec iov = {const_cast<char*>(out_bytes), amt_to_write};
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } 846 }
847 #endif 847 #endif
848 } 848 }
849 849
850 if (bytes_written == 1) { 850 if (bytes_written == 1) {
851 fd_written = pipe_; 851 fd_written = pipe_;
852 #if !defined(OS_MACOSX) 852 #if !defined(OS_MACOSX)
853 if (mode_ != MODE_SERVER && !uses_fifo_ && 853 if (mode_ != MODE_SERVER && !uses_fifo_ &&
854 msg->routing_id() == MSG_ROUTING_NONE && 854 msg->routing_id() == MSG_ROUTING_NONE &&
855 msg->type() == HELLO_MESSAGE_TYPE) { 855 msg->type() == HELLO_MESSAGE_TYPE) {
856 DCHECK_EQ(msg->file_descriptor_set()->size(), 1); 856 DCHECK_EQ(msg->file_descriptor_set()->size(), 1U);
857 } 857 }
858 if (!uses_fifo_ && !msgh.msg_controllen) { 858 if (!uses_fifo_ && !msgh.msg_controllen) {
859 bytes_written = HANDLE_EINTR(write(pipe_, out_bytes, amt_to_write)); 859 bytes_written = HANDLE_EINTR(write(pipe_, out_bytes, amt_to_write));
860 } else 860 } else
861 #endif 861 #endif
862 { 862 {
863 bytes_written = HANDLE_EINTR(sendmsg(pipe_, &msgh, MSG_DONTWAIT)); 863 bytes_written = HANDLE_EINTR(sendmsg(pipe_, &msgh, MSG_DONTWAIT));
864 } 864 }
865 } 865 }
866 if (bytes_written > 0) 866 if (bytes_written > 0)
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1080
1081 bool Channel::Send(Message* message) { 1081 bool Channel::Send(Message* message) {
1082 return channel_impl_->Send(message); 1082 return channel_impl_->Send(message);
1083 } 1083 }
1084 1084
1085 int Channel::GetClientFileDescriptor() const { 1085 int Channel::GetClientFileDescriptor() const {
1086 return channel_impl_->GetClientFileDescriptor(); 1086 return channel_impl_->GetClientFileDescriptor();
1087 } 1087 }
1088 1088
1089 } // namespace IPC 1089 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc.gyp ('k') | ipc/ipc_fuzzing_tests.cc » ('j') | ipc/ipc_logging.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698