| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ | 5 #ifndef LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ |
| 6 #define LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ | 6 #define LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ |
| 7 | 7 |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <ppapi/c/pp_resource.h> | 10 #include <ppapi/c/pp_resource.h> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 class SocketNode; | 25 class SocketNode; |
| 26 | 26 |
| 27 // HandleAttr struct is passed the Node in calls | 27 // HandleAttr struct is passed the Node in calls |
| 28 // to Read and Write. It contains handle specific state | 28 // to Read and Write. It contains handle specific state |
| 29 // such as the file offset and the open flags. | 29 // such as the file offset and the open flags. |
| 30 struct HandleAttr { | 30 struct HandleAttr { |
| 31 HandleAttr() : offs(0), flags(0) {} | 31 HandleAttr() : offs(0), flags(0) {} |
| 32 bool IsBlocking() const { return !(flags & O_NONBLOCK); } | 32 bool IsBlocking() const { return !(flags & O_NONBLOCK); } |
| 33 | 33 |
| 34 size_t offs; | 34 off_t offs; |
| 35 int flags; | 35 int flags; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // KernelHandle provides a reference counted container for the open | 38 // KernelHandle provides a reference counted container for the open |
| 39 // file information, such as it's filesystem, node, access type and offset. | 39 // file information, such as it's filesystem, node, access type and offset. |
| 40 // KernelHandle can only be referenced when the KernelProxy lock is held. | 40 // KernelHandle can only be referenced when the KernelProxy lock is held. |
| 41 class KernelHandle : public sdk_util::RefObject { | 41 class KernelHandle : public sdk_util::RefObject { |
| 42 public: | 42 public: |
| 43 | 43 |
| 44 KernelHandle(); | 44 KernelHandle(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 friend class KernelProxy; | 91 friend class KernelProxy; |
| 92 DISALLOW_COPY_AND_ASSIGN(KernelHandle); | 92 DISALLOW_COPY_AND_ASSIGN(KernelHandle); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 typedef sdk_util::ScopedRef<KernelHandle> ScopedKernelHandle; | 95 typedef sdk_util::ScopedRef<KernelHandle> ScopedKernelHandle; |
| 96 | 96 |
| 97 } // namespace nacl_io | 97 } // namespace nacl_io |
| 98 | 98 |
| 99 #endif // LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ | 99 #endif // LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ |
| OLD | NEW |