| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/supports_user_data.h" | 5 #include "base/supports_user_data.h" |
| 6 | 6 |
| 7 namespace base { | 7 namespace base { |
| 8 | 8 |
| 9 SupportsUserData::SupportsUserData() { | 9 SupportsUserData::SupportsUserData() {} |
| 10 } | |
| 11 | |
| 12 SupportsUserData::~SupportsUserData() { | |
| 13 } | |
| 14 | 10 |
| 15 SupportsUserData::Data* SupportsUserData::GetUserData(const void* key) const { | 11 SupportsUserData::Data* SupportsUserData::GetUserData(const void* key) const { |
| 16 DataMap::const_iterator found = user_data_.find(key); | 12 DataMap::const_iterator found = user_data_.find(key); |
| 17 if (found != user_data_.end()) | 13 if (found != user_data_.end()) |
| 18 return found->second.get(); | 14 return found->second.get(); |
| 19 return NULL; | 15 return NULL; |
| 20 } | 16 } |
| 21 | 17 |
| 22 void SupportsUserData::SetUserData(const void* key, Data* data) { | 18 void SupportsUserData::SetUserData(const void* key, Data* data) { |
| 23 user_data_[key] = linked_ptr<Data>(data); | 19 user_data_[key] = linked_ptr<Data>(data); |
| 24 } | 20 } |
| 25 | 21 |
| 22 SupportsUserData::~SupportsUserData() {} |
| 23 |
| 26 } // namespace base | 24 } // namespace base |
| OLD | NEW |