Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ppapi / shared_impl / platform_file.cc
blob0bdd5db7f8ea879051d7fbcdc309bdd46ef4b1c4
1 // Copyright (c) 2011 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 "ppapi/shared_impl/platform_file.h"
7 namespace ppapi {
9 // TODO(piman/brettw): Change trusted interface to return a PP_FileHandle,
10 // those casts are ugly.
11 base::PlatformFile IntToPlatformFile(int32_t handle) {
12 #if defined(OS_WIN)
13 return reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle));
14 #elif defined(OS_POSIX)
15 return handle;
16 #else
17 #error Not implemented.
18 #endif
21 int32_t PlatformFileToInt(base::PlatformFile handle) {
22 #if defined(OS_WIN)
23 return static_cast<int32_t>(reinterpret_cast<intptr_t>(handle));
24 #elif defined(OS_POSIX)
25 return handle;
26 #else
27 #error Not implemented.
28 #endif
31 } // namespace ppapi