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

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

Issue 1388413005: Move //mojo/services/X/public/... to //mojo/services/X/... (part 1). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 | « mojo/services/files/public/c/lib/singletons.h ('k') | mojo/services/files/public/c/lib/template_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/files/public/c/lib/singletons.cc
diff --git a/mojo/services/files/public/c/lib/singletons.cc b/mojo/services/files/public/c/lib/singletons.cc
deleted file mode 100644
index 58d23c1313dce1e5f52240a7c1d1fff12cfca2c7..0000000000000000000000000000000000000000
--- a/mojo/services/files/public/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 "files/public/c/lib/singletons.h"
-
-#include <errno.h>
-
-#include "files/public/c/lib/directory_wrapper.h"
-#include "files/public/c/lib/fd_table.h"
-#include "files/public/c/lib/real_errno_impl.h"
-#include "files/public/c/mojio_config.h"
-#include "mojo/public/cpp/environment/logging.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 | « mojo/services/files/public/c/lib/singletons.h ('k') | mojo/services/files/public/c/lib/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698