summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_nacl.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 19:57:22 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 19:57:22 +0000
commit456b0eae088adc8f03ebcae2025a2af1cdc7a9e9 (patch)
treeb81eb9371d0213e61cf8d9e5dd2a0e06273991a8 /ipc/ipc_channel_nacl.cc
parent590e2e2ed0c97ab2e0860c49b0c51c3bfe5fc450 (diff)
downloadchromium_src-456b0eae088adc8f03ebcae2025a2af1cdc7a9e9.zip
chromium_src-456b0eae088adc8f03ebcae2025a2af1cdc7a9e9.tar.gz
chromium_src-456b0eae088adc8f03ebcae2025a2af1cdc7a9e9.tar.bz2
Add a stub version of IPC::Channel for Native Client code.
This isn't used yet, but will be necessary to get us linking when the build system is in better shape. Once that works we can start implementing this for real. Review URL: https://chromiumcodereview.appspot.com/9876003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_nacl.cc')
-rw-r--r--ipc/ipc_channel_nacl.cc142
1 files changed, 142 insertions, 0 deletions
diff --git a/ipc/ipc_channel_nacl.cc b/ipc/ipc_channel_nacl.cc
new file mode 100644
index 0000000..0d929db
--- /dev/null
+++ b/ipc/ipc_channel_nacl.cc
@@ -0,0 +1,142 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ipc/ipc_channel_nacl.h"
+
+#include "base/file_util.h"
+#include "base/logging.h"
+
+// This file is currently a stub to get us linking.
+// TODO(brettw) implement this.
+
+namespace IPC {
+
+ChannelImpl::ChannelImpl(const IPC::ChannelHandle& channel_handle,
+ Mode mode,
+ Listener* listener)
+ : ChannelReader(listener) {
+}
+
+ChannelImpl::~ChannelImpl() {
+ Close();
+}
+
+bool ChannelImpl::Connect() {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void ChannelImpl::Close() {
+ NOTIMPLEMENTED();
+}
+
+bool ChannelImpl::Send(Message* message) {
+ NOTIMPLEMENTED();
+}
+
+int ChannelImpl::GetClientFileDescriptor() const {
+ NOTIMPLEMENTED();
+ return -1;
+}
+
+int ChannelImpl::TakeClientFileDescriptor() {
+ NOTIMPLEMENTED();
+ return -1;
+}
+
+bool ChannelImpl::AcceptsConnections() const {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool ChannelImpl::HasAcceptedConnection() const {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool ChannelImpl::GetClientEuid(uid_t* client_euid) const {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void ChannelImpl::ResetToAcceptingConnectionState() {
+ NOTIMPLEMENTED();
+}
+
+// static
+bool Channel::ChannelImpl::IsNamedServerInitialized(
+ const std::string& channel_id) {
+ return file_util::PathExists(FilePath(channel_id));
+}
+
+//------------------------------------------------------------------------------
+// Channel's methods simply call through to ChannelImpl.
+
+Channel::Channel(const IPC::ChannelHandle& channel_handle,
+ Mode mode,
+ Listener* listener)
+ : channel_impl_(new ChannelImpl(channel_handle, mode, listener)) {
+}
+
+Channel::~Channel() {
+ delete channel_impl_;
+}
+
+bool Channel::Connect() {
+ return channel_impl_->Connect();
+}
+
+void Channel::Close() {
+ channel_impl_->Close();
+}
+
+void Channel::set_listener(Listener* listener) {
+ channel_impl_->set_listener(listener);
+}
+
+bool Channel::Send(Message* message) {
+ return channel_impl_->Send(message);
+}
+
+int Channel::GetClientFileDescriptor() const {
+ return channel_impl_->GetClientFileDescriptor();
+}
+
+int Channel::TakeClientFileDescriptor() {
+ return channel_impl_->TakeClientFileDescriptor();
+}
+
+bool Channel::AcceptsConnections() const {
+ return channel_impl_->AcceptsConnections();
+}
+
+bool Channel::HasAcceptedConnection() const {
+ return channel_impl_->HasAcceptedConnection();
+}
+
+bool Channel::GetClientEuid(uid_t* client_euid) const {
+ return channel_impl_->GetClientEuid(client_euid);
+}
+
+void Channel::ResetToAcceptingConnectionState() {
+ channel_impl_->ResetToAcceptingConnectionState();
+}
+
+// static
+bool Channel::IsNamedServerInitialized(const std::string& channel_id) {
+ return ChannelImpl::IsNamedServerInitialized(channel_id);
+}
+
+// static
+std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) {
+ // A random name is sufficient validation on posix systems, so we don't need
+ // an additional shared secret.
+ std::string id = prefix;
+ if (!id.empty())
+ id.append(".");
+
+ return id.append(GenerateUniqueRandomChannelID());
+}
+
+} // namespace IPC