Home | History | Annotate | Download | only in common
      1 // Copyright (c) 2009 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.
      4 
      5 // Handle passing definitions for NaCl
      6 #ifndef CHROME_COMMON_NACL_TYPES_H_
      7 #define CHROME_COMMON_NACL_TYPES_H_
      8 #pragma once
      9 
     10 #if defined(OS_POSIX)
     11 #include "base/file_descriptor_posix.h"
     12 #endif
     13 
     14 // TODO(gregoryd): add a Windows definition for base::FileDescriptor
     15 namespace nacl {
     16 #if defined(OS_WIN)
     17   // We assume that HANDLE always uses less than 32 bits
     18   typedef int FileDescriptor;
     19   inline HANDLE ToNativeHandle(const FileDescriptor& desc) {
     20     return reinterpret_cast<HANDLE>(desc);
     21   }
     22 #elif defined(OS_POSIX)
     23   typedef base::FileDescriptor FileDescriptor;
     24   inline int ToNativeHandle(const FileDescriptor& desc) {
     25     return desc.fd;
     26   }
     27 #endif
     28 }
     29 
     30 #endif  // CHROME_COMMON_NACL_TYPES_H_
     31