cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / cpp / private / pass_file_handle.cc
blob5735d33a71f5ae6461ad9f4c07552b3cb1dff022
1 // Copyright (c) 2013 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/cpp/private/pass_file_handle.h"
7 #ifdef _WIN32
8 # include <windows.h>
9 #else
10 # include <unistd.h>
11 #endif
13 namespace pp {
15 PassFileHandle::PassFileHandle()
16 : handle_(PP_kInvalidFileHandle) {
19 PassFileHandle::PassFileHandle(PP_FileHandle handle)
20 : handle_(handle) {
23 PassFileHandle::PassFileHandle(PassFileHandle& handle)
24 : handle_(handle.Release()) {
27 PassFileHandle::~PassFileHandle() {
28 Close();
31 PP_FileHandle PassFileHandle::Release() {
32 PP_FileHandle released = handle_;
33 handle_ = PP_kInvalidFileHandle;
34 return released;
37 void PassFileHandle::Close() {
38 if (handle_ != PP_kInvalidFileHandle) {
39 #ifdef _WIN32
40 CloseHandle(handle_);
41 #else
42 close(handle_);
43 #endif
44 handle_ = PP_kInvalidFileHandle;
48 } // namespace pp