Limit App Host installation / usage for platform apps to Google Chome only.
[chromium-blink-merge.git] / base / sync_socket_nacl.cc
blob6d6405d23cd63114e96ad4a71ac1024cabc97d8e
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
3 // found in the LICENSE file.
5 #include "base/sync_socket.h"
7 #include <errno.h>
8 #include <limits.h>
9 #include <stdio.h>
10 #include <sys/types.h>
12 #include "base/file_util.h"
13 #include "base/logging.h"
16 namespace base {
18 const SyncSocket::Handle SyncSocket::kInvalidHandle = -1;
20 SyncSocket::SyncSocket() : handle_(kInvalidHandle) {
23 SyncSocket::~SyncSocket() {
26 // static
27 bool SyncSocket::CreatePair(SyncSocket* socket_a, SyncSocket* socket_b) {
28 return false;
31 bool SyncSocket::Close() {
32 if (handle_ != kInvalidHandle) {
33 if (close(handle_) < 0)
34 DPLOG(ERROR) << "close";
35 handle_ = -1;
37 return true;
40 size_t SyncSocket::Send(const void* buffer, size_t length) {
41 // Not implemented since it's not needed by any client code yet.
42 return -1;
45 size_t SyncSocket::Receive(void* buffer, size_t length) {
46 return read(handle_, buffer, length);
49 size_t SyncSocket::Peek() {
50 return -1;
53 CancelableSyncSocket::CancelableSyncSocket() {
56 CancelableSyncSocket::CancelableSyncSocket(Handle handle)
57 : SyncSocket(handle) {
60 size_t CancelableSyncSocket::Send(const void* buffer, size_t length) {
61 return -1;
64 bool CancelableSyncSocket::Shutdown() {
65 return false;
68 // static
69 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a,
70 CancelableSyncSocket* socket_b) {
71 return SyncSocket::CreatePair(socket_a, socket_b);
74 } // namespace base