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

Unified Diff: mojo/common/environment_data.cc

Issue 281353005: Mojo: nuke EnvironmentData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix gn Created 6 years, 6 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/common/environment_data.h ('k') | mojo/common/handle_watcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/environment_data.cc
diff --git a/mojo/common/environment_data.cc b/mojo/common/environment_data.cc
deleted file mode 100644
index b523d272c8ebf4f42e93b01c9680c9e40fd1979b..0000000000000000000000000000000000000000
--- a/mojo/common/environment_data.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 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 "mojo/common/environment_data.h"
-
-#include "base/stl_util.h"
-
-namespace mojo {
-namespace common {
-
-// static
-EnvironmentData* EnvironmentData::instance_ = NULL;
-
-EnvironmentData::EnvironmentData() {
- DCHECK(!instance_);
- instance_ = this;
-}
-
-EnvironmentData::~EnvironmentData() {
- instance_ = NULL;
- DataMap data_map;
- data_map.swap(data_map_);
- STLDeleteContainerPairSecondPointers(data_map.begin(), data_map.end());
-}
-
-// static
-EnvironmentData* EnvironmentData::GetInstance() {
- return instance_;
-}
-
-void EnvironmentData::SetData(const void* key, scoped_ptr<Data> data) {
- Data* old = NULL;
- {
- base::AutoLock auto_lock(data_lock_);
- old = data_map_[key];
- if (data)
- data_map_[key] = data.release();
- else
- data_map_.erase(key);
- }
- delete old;
-}
-
-EnvironmentData::Data* EnvironmentData::GetData(const void* key) {
- base::AutoLock auto_lock(data_lock_);
- return data_map_.count(key) > 0 ? data_map_[key] : NULL;
-}
-
-} // namespace common
-} // namespace mojo
« no previous file with comments | « mojo/common/environment_data.h ('k') | mojo/common/handle_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698