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

Side by Side Diff: ipc/ipc_channel_posix.cc

Issue 320433002: IPC::Channel: Reduce POSIX specific API surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 "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/socket.h> 10 #include <sys/socket.h>
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 base::ProcessId ChannelPosix::GetPeerPID() const { 1049 base::ProcessId ChannelPosix::GetPeerPID() const {
1050 return peer_pid_; 1050 return peer_pid_;
1051 } 1051 }
1052 1052
1053 //------------------------------------------------------------------------------ 1053 //------------------------------------------------------------------------------
1054 // Channel's methods 1054 // Channel's methods
1055 1055
1056 // static 1056 // static
1057 scoped_ptr<Channel> Channel::Create( 1057 scoped_ptr<Channel> Channel::Create(
1058 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) { 1058 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) {
1059 return scoped_ptr<Channel>( 1059 return ChannelPosix::Create(channel_handle, mode, listener).PassAs<Channel>();
jam 2014/06/06 14:47:13 nit: i think you forgot to update this
1060 new ChannelPosix(channel_handle, mode, listener));
1061 } 1060 }
1062 1061
1063 // static 1062 // static
1064 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { 1063 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) {
1065 // A random name is sufficient validation on posix systems, so we don't need 1064 // A random name is sufficient validation on posix systems, so we don't need
1066 // an additional shared secret. 1065 // an additional shared secret.
1067 1066
1068 std::string id = prefix; 1067 std::string id = prefix;
1069 if (!id.empty()) 1068 if (!id.empty())
1070 id.append("."); 1069 id.append(".");
1071 1070
1072 return id.append(GenerateUniqueRandomChannelID()); 1071 return id.append(GenerateUniqueRandomChannelID());
1073 } 1072 }
1074 1073
1075 1074
1076 bool Channel::IsNamedServerInitialized( 1075 bool Channel::IsNamedServerInitialized(
1077 const std::string& channel_id) { 1076 const std::string& channel_id) {
1078 return ChannelPosix::IsNamedServerInitialized(channel_id); 1077 return ChannelPosix::IsNamedServerInitialized(channel_id);
1079 } 1078 }
1080 1079
1081 #if defined(OS_LINUX) 1080 #if defined(OS_LINUX)
1082 // static 1081 // static
1083 void Channel::SetGlobalPid(int pid) { 1082 void Channel::SetGlobalPid(int pid) {
1084 ChannelPosix::SetGlobalPid(pid); 1083 ChannelPosix::SetGlobalPid(pid);
1085 } 1084 }
1086 #endif // OS_LINUX 1085 #endif // OS_LINUX
1087 1086
1088 } // namespace IPC 1087 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698