| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "mojo/system/platform_channel_handle.h" | 5 #include "mojo/system/platform_handle.h" | 
| 6 | 6 | 
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" | 
| 8 #if defined(OS_POSIX) | 8 #if defined(OS_POSIX) | 
| 9 #include <unistd.h> | 9 #include <unistd.h> | 
| 10 #elif defined(OS_WIN) | 10 #elif defined(OS_WIN) | 
| 11 #include <windows.h> | 11 #include <windows.h> | 
| 12 #else | 12 #else | 
| 13 #error "Platform not yet supported." | 13 #error "Platform not yet supported." | 
| 14 #endif | 14 #endif | 
| 15 | 15 | 
|  | 16 #include "base/compiler_specific.h" | 
| 16 #include "base/logging.h" | 17 #include "base/logging.h" | 
| 17 | 18 | 
| 18 namespace mojo { | 19 namespace mojo { | 
| 19 namespace system { | 20 namespace system { | 
| 20 | 21 | 
| 21 void PlatformChannelHandle::CloseIfNecessary() { | 22 void PlatformHandle::CloseIfNecessary() { | 
| 22   if (!is_valid()) | 23   if (!is_valid()) | 
| 23     return; | 24     return; | 
| 24 | 25 | 
| 25 #if defined(OS_POSIX) | 26 #if defined(OS_POSIX) | 
| 26   DPCHECK(close(fd) == 0); | 27   bool success = (close(fd) == 0); | 
|  | 28   DPCHECK(success); | 
| 27   fd = -1; | 29   fd = -1; | 
| 28 #elif defined(OS_WIN) | 30 #elif defined(OS_WIN) | 
| 29   DPCHECK(CloseHandle(handle)); | 31   bool success = !!CloseHandle(handle); | 
|  | 32   DPCHECK(success); | 
| 30   handle = INVALID_HANDLE_VALUE; | 33   handle = INVALID_HANDLE_VALUE; | 
| 31 #else | 34 #else | 
| 32 #error "Platform not yet supported." | 35 #error "Platform not yet supported." | 
| 33 #endif | 36 #endif | 
| 34 } | 37 } | 
| 35 | 38 | 
| 36 }  // namespace system | 39 }  // namespace system | 
| 37 }  // namespace mojo | 40 }  // namespace mojo | 
| OLD | NEW | 
|---|