| 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_MOUNTS_MOUNT_H_ | 5 #ifndef LIBRARIES_NACL_MOUNTS_MOUNT_H_ |
| 6 #define LIBRARIES_NACL_MOUNTS_MOUNT_H_ | 6 #define LIBRARIES_NACL_MOUNTS_MOUNT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 protected: | 64 protected: |
| 65 // Device number for the mount. | 65 // Device number for the mount. |
| 66 int dev_; | 66 int dev_; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // May only be called by the KernelProxy when the Kernel's | 69 // May only be called by the KernelProxy when the Kernel's |
| 70 // lock is held, so we make it private. | 70 // lock is held, so we make it private. |
| 71 friend class KernelObject; | 71 friend class KernelObject; |
| 72 friend class KernelProxy; | 72 friend class KernelProxy; |
| 73 void Acquire() { RefObject::Acquire(); } | 73 void Acquire() { RefObject::Acquire(); } |
| 74 void Release() { RefObject::Release(); } | 74 bool Release() { return RefObject::Release(); } |
| 75 | 75 |
| 76 template <class M, class P> friend class MountFactory; | 76 template <class M, class P> friend class MountFactory; |
| 77 DISALLOW_COPY_AND_ASSIGN(Mount); | 77 DISALLOW_COPY_AND_ASSIGN(Mount); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 | 80 |
| 81 template<class C, class P> class MountFactory : public P { | 81 template<class C, class P> class MountFactory : public P { |
| 82 protected: | 82 public: |
| 83 MountFactory() | |
| 84 : P() {} | |
| 85 | |
| 86 static Mount* Create(int dev, StringMap_t& args) { | 83 static Mount* Create(int dev, StringMap_t& args) { |
| 87 Mount* mnt = new C(); | 84 Mount* mnt = new C(); |
| 88 if (mnt->Init(dev, args) == false) { | 85 if (mnt->Init(dev, args) == false) { |
| 89 delete mnt; | 86 delete mnt; |
| 90 return NULL; | 87 return NULL; |
| 91 } | 88 } |
| 92 return mnt; | 89 return mnt; |
| 93 } | 90 } |
| 94 | 91 |
| 95 friend class KernelProxy; | 92 protected: |
| 93 MountFactory(): P() {} |
| 96 }; | 94 }; |
| 97 | 95 |
| 98 #endif // LIBRARIES_NACL_MOUNTS_MOUNT_H_ | 96 #endif // LIBRARIES_NACL_MOUNTS_MOUNT_H_ |
| OLD | NEW |