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

Unified Diff: base/supports_user_data.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « base/supports_user_data.h ('k') | base/supports_user_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/supports_user_data.cc
diff --git a/base/supports_user_data.cc b/base/supports_user_data.cc
deleted file mode 100644
index 9689014d4ad8ebe08b487e228f7fa67b6e052e7f..0000000000000000000000000000000000000000
--- a/base/supports_user_data.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2012 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 "base/supports_user_data.h"
-
-namespace base {
-
-SupportsUserData::SupportsUserData() {
- // Harmless to construct on a different thread to subsequent usage.
- thread_checker_.DetachFromThread();
-}
-
-SupportsUserData::Data* SupportsUserData::GetUserData(const void* key) const {
- DCHECK(thread_checker_.CalledOnValidThread());
- DataMap::const_iterator found = user_data_.find(key);
- if (found != user_data_.end())
- return found->second.get();
- return NULL;
-}
-
-void SupportsUserData::SetUserData(const void* key, Data* data) {
- DCHECK(thread_checker_.CalledOnValidThread());
- user_data_[key] = linked_ptr<Data>(data);
-}
-
-void SupportsUserData::RemoveUserData(const void* key) {
- DCHECK(thread_checker_.CalledOnValidThread());
- user_data_.erase(key);
-}
-
-void SupportsUserData::DetachUserDataThread() {
- thread_checker_.DetachFromThread();
-}
-
-SupportsUserData::~SupportsUserData() {
- DCHECK(thread_checker_.CalledOnValidThread() || user_data_.empty());
- DataMap local_user_data;
- user_data_.swap(local_user_data);
- // Now this->user_data_ is empty, and any destructors called transitively from
- // the destruction of |local_user_data| will see it that way instead of
- // examining a being-destroyed object.
-}
-
-} // namespace base
« no previous file with comments | « base/supports_user_data.h ('k') | base/supports_user_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698