diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-23 23:46:46 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-23 23:46:46 +0000 |
commit | 5a77eca1f12943edb45b032219da0f32057240fd (patch) | |
tree | b08f598e12e42cfffeead23307ebcf61afc622f1 /ppapi/shared_impl/platform_file.cc | |
parent | 5f903b636a1cb8cff34eff4c51be7d7948744025 (diff) | |
download | chromium_src-5a77eca1f12943edb45b032219da0f32057240fd.zip chromium_src-5a77eca1f12943edb45b032219da0f32057240fd.tar.gz chromium_src-5a77eca1f12943edb45b032219da0f32057240fd.tar.bz2 |
Merge definitions of PlatformFileToInt and IntToPlatformFile to one place.
BUG=none
TEST=normal browsing on m17
Review URL: http://codereview.chromium.org/8585013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/platform_file.cc')
-rw-r--r-- | ppapi/shared_impl/platform_file.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ppapi/shared_impl/platform_file.cc b/ppapi/shared_impl/platform_file.cc new file mode 100644 index 0000000..fe9c2ff --- /dev/null +++ b/ppapi/shared_impl/platform_file.cc @@ -0,0 +1,31 @@ +// Copyright (c) 2011 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 "ppapi/shared_impl/platform_file.h" + +namespace ppapi { + +// TODO(piman/brettw): Change trusted interface to return a PP_FileHandle, +// those casts are ugly. +base::PlatformFile IntToPlatformFile(int32_t handle) { +#if defined(OS_WIN) + return reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); +#elif defined(OS_POSIX) + return handle; +#else + #error Not implemented. +#endif +} + +int32_t PlatformFileToInt(base::PlatformFile handle) { +#if defined(OS_WIN) + return static_cast<int32_t>(reinterpret_cast<intptr_t>(handle)); +#elif defined(OS_POSIX) + return handle; +#else + #error Not implemented. +#endif +} + +} // namespace ppapi |