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

Unified Diff: services/files/c/lib/fd_table.h

Issue 1133933002: Move //services/files/c -> //mojo/services/files/public/c. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove data dep Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/files/c/lib/fd_impl.h ('k') | services/files/c/lib/fd_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/files/c/lib/fd_table.h
diff --git a/services/files/c/lib/fd_table.h b/services/files/c/lib/fd_table.h
deleted file mode 100644
index e5dcef9d9cc96f0a26baca58e6e23295b113def3..0000000000000000000000000000000000000000
--- a/services/files/c/lib/fd_table.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SERVICES_FILES_C_LIB_FD_TABLE_H_
-#define SERVICES_FILES_C_LIB_FD_TABLE_H_
-
-#include <stddef.h>
-
-#include <memory>
-#include <vector>
-
-#include "mojo/public/cpp/system/macros.h"
-#include "services/files/c/lib/fd_impl.h"
-
-namespace mojio {
-
-class ErrnoImpl;
-
-// A simple (thread-unsafe) implementation of an FD (file descriptor) table,
-// mapping FDs (integers) to |FDImpl|s. (Note that on failure, all the methods
-// set "errno" using the |ErrnoImpl| provided to the constructor.)
-class FDTable {
- public:
- // The |ErrnoImpl| must outlive this object. |max_num_fds| is the maximum
- // number of FDs allowed (simultaneously). This number should be relatively
- // small (hundreds to maybe tens of thousands, certainly not millions).
- FDTable(ErrnoImpl* errno_impl, size_t max_num_fds);
- // Note: This does not |Close()| any remaining |FDImpl|s.
- ~FDTable();
-
- // Returns the new FD (>= 0) on success and -1 on failure. Note that the
- // lowest-valued FD available is always allocated.
- int Add(std::unique_ptr<FDImpl> fd_impl);
-
- // Returns the |FDImpl| associated to |fd| (null if |fd| is not valid),
- // keeping the |FDImpl| in the table (and thus |fd| valid).
- FDImpl* Get(int fd) const;
-
- // Removes and returns the |FDImpl| associated to |fd| (null if |fd| is not
- // valid). Note that |Close()| is not called on the |FDImpl|.
- std::unique_ptr<FDImpl> Remove(int fd);
-
- ErrnoImpl* errno_impl() const { return errno_impl_; }
- size_t max_num_fds() const { return table_.size(); }
-
- private:
- ErrnoImpl* const errno_impl_;
- std::vector<std::unique_ptr<FDImpl>> table_;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(FDTable);
-};
-
-} // namespace mojio
-
-#endif // SERVICES_FILES_C_LIB_FD_TABLE_H_
« no previous file with comments | « services/files/c/lib/fd_impl.h ('k') | services/files/c/lib/fd_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698