Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_object.h

Issue 19717004: [NaCl SDK] Add nacl_io and sdk_util namespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad copyright in mount_mem Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_OBJECT_H_ 5 #ifndef LIBRARIES_NACL_IO_KERNEL_OBJECT_H_
6 #define LIBRARIES_NACL_IO_KERNEL_OBJECT_H_ 6 #define LIBRARIES_NACL_IO_KERNEL_OBJECT_H_
7 7
8 #include <pthread.h> 8 #include <pthread.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "nacl_io/error.h" 14 #include "nacl_io/error.h"
15 #include "nacl_io/kernel_handle.h" 15 #include "nacl_io/kernel_handle.h"
16 #include "nacl_io/mount.h" 16 #include "nacl_io/mount.h"
17 #include "nacl_io/mount_node.h" 17 #include "nacl_io/mount_node.h"
18 #include "nacl_io/path.h" 18 #include "nacl_io/path.h"
19 19
20 #include "sdk_util/simple_lock.h" 20 #include "sdk_util/simple_lock.h"
21 21
22 namespace nacl_io {
22 23
23 // KernelObject provides basic functionality for threadsafe access to kernel 24 // KernelObject provides basic functionality for threadsafe access to kernel
24 // objects such as the CWD, mount points, file descriptors and file handles. 25 // objects such as the CWD, mount points, file descriptors and file handles.
25 // All Kernel locks are private to ensure the lock order. 26 // All Kernel locks are private to ensure the lock order.
26 // 27 //
27 // All calls are assumed to be a relative path. 28 // All calls are assumed to be a relative path.
28 class KernelObject { 29 class KernelObject {
29 public: 30 public:
30 typedef std::vector<ScopedKernelHandle> HandleMap_t; 31 typedef std::vector<ScopedKernelHandle> HandleMap_t;
31 typedef std::map<std::string, ScopedMount> MountMap_t; 32 typedef std::map<std::string, ScopedMount> MountMap_t;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // Returns parts of the absolute path for the given relative path 75 // Returns parts of the absolute path for the given relative path
75 Path GetAbsParts(const std::string& path); 76 Path GetAbsParts(const std::string& path);
76 77
77 private: 78 private:
78 std::string cwd_; 79 std::string cwd_;
79 std::vector<int> free_fds_; 80 std::vector<int> free_fds_;
80 HandleMap_t handle_map_; 81 HandleMap_t handle_map_;
81 MountMap_t mounts_; 82 MountMap_t mounts_;
82 83
83 // Lock to protect free_fds_ and handle_map_. 84 // Lock to protect free_fds_ and handle_map_.
84 SimpleLock handle_lock_; 85 sdk_util::SimpleLock handle_lock_;
85 86
86 // Lock to protect handle_map_. 87 // Lock to protect handle_map_.
87 SimpleLock mount_lock_; 88 sdk_util::SimpleLock mount_lock_;
88 89
89 // Lock to protect cwd_. 90 // Lock to protect cwd_.
90 SimpleLock cwd_lock_; 91 sdk_util::SimpleLock cwd_lock_;
91 92
92 DISALLOW_COPY_AND_ASSIGN(KernelObject); 93 DISALLOW_COPY_AND_ASSIGN(KernelObject);
93 }; 94 };
94 95
96 } // namespace nacl_io
97
95 #endif // LIBRARIES_NACL_IO_KERNEL_OBJECT_H_ 98 #endif // LIBRARIES_NACL_IO_KERNEL_OBJECT_H_
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc ('k') | native_client_sdk/src/libraries/nacl_io/kernel_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698