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

Unified Diff: services/files/c/lib/singletons.cc

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/singletons.h ('k') | services/files/c/lib/template_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/files/c/lib/singletons.cc
diff --git a/services/files/c/lib/singletons.cc b/services/files/c/lib/singletons.cc
deleted file mode 100644
index 21e37656343ba2ecc3d815cf09c43ae6cea848f2..0000000000000000000000000000000000000000
--- a/services/files/c/lib/singletons.cc
+++ /dev/null
@@ -1,76 +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.
-
-#include "services/files/c/lib/singletons.h"
-
-#include <errno.h>
-
-#include "mojo/public/cpp/environment/logging.h"
-#include "services/files/c/lib/directory_wrapper.h"
-#include "services/files/c/lib/fd_table.h"
-#include "services/files/c/lib/real_errno_impl.h"
-#include "services/files/c/mojio_config.h"
-
-namespace mojio {
-namespace singletons {
-
-namespace {
-
-RealErrnoImpl* g_errno_impl = nullptr;
-FDTable* g_fd_table = nullptr;
-DirectoryWrapper* g_current_working_directory = nullptr;
-
-} // namespace
-
-ErrnoImpl* GetErrnoImpl() {
- if (!g_errno_impl)
- g_errno_impl = new RealErrnoImpl(); // Does NOT modify errno.
- return g_errno_impl;
-}
-
-void ResetErrnoImpl() {
- delete g_errno_impl; // Does NOT modify errno.
- g_errno_impl = nullptr;
-}
-
-FDTable* GetFDTable() {
- ErrnoImpl::Setter errno_setter(GetErrnoImpl()); // Protect errno.
- if (!g_fd_table)
- g_fd_table = new FDTable(GetErrnoImpl(), MOJIO_CONFIG_MAX_NUM_FDS);
- return g_fd_table;
-}
-
-void ResetFDTable() {
- ErrnoImpl::Setter errno_setter(GetErrnoImpl()); // Protect errno.
- delete g_fd_table;
- g_fd_table = nullptr;
-}
-
-void SetCurrentWorkingDirectory(mojo::files::DirectoryPtr directory) {
- delete g_current_working_directory;
- g_current_working_directory =
- new DirectoryWrapper(GetErrnoImpl(), directory.Pass());
-}
-
-DirectoryWrapper* GetCurrentWorkingDirectory() {
- ErrnoImpl::Setter errno_setter(GetErrnoImpl());
- if (!g_current_working_directory) {
- // TODO(vtl): Ponder this error code. (This is, e.g., what openat() would
- // return if its dirfd were not valid.)
- errno_setter.Set(EBADF);
- MOJO_LOG(ERROR) << "No current working directory";
- return nullptr;
- }
-
- return g_current_working_directory;
-}
-
-void ResetCurrentWorkingDirectory() {
- ErrnoImpl::Setter errno_setter(GetErrnoImpl()); // Protect errno.
- delete g_current_working_directory;
- g_current_working_directory = nullptr;
-}
-
-} // namespace singletons
-} // namespace mojio
« no previous file with comments | « services/files/c/lib/singletons.h ('k') | services/files/c/lib/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698