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

Side by Side Diff: base/values.cc

Issue 23903040: Fix memory leak in PrefMetricsService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/values.h ('k') | chrome/browser/prefs/pref_metrics_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/values.h" 5 #include "base/values.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <ostream> 10 #include <ostream>
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 748
749 Value* entry = entry_iterator->second; 749 Value* entry = entry_iterator->second;
750 if (out_value) 750 if (out_value)
751 out_value->reset(entry); 751 out_value->reset(entry);
752 else 752 else
753 delete entry; 753 delete entry;
754 dictionary_.erase(entry_iterator); 754 dictionary_.erase(entry_iterator);
755 return true; 755 return true;
756 } 756 }
757 757
758 DictionaryValue* DictionaryValue::DeepCopyWithoutEmptyChildren() { 758 DictionaryValue* DictionaryValue::DeepCopyWithoutEmptyChildren() const {
759 Value* copy = CopyWithoutEmptyChildren(this); 759 Value* copy = CopyWithoutEmptyChildren(this);
760 return copy ? static_cast<DictionaryValue*>(copy) : new DictionaryValue; 760 return copy ? static_cast<DictionaryValue*>(copy) : new DictionaryValue;
761 } 761 }
762 762
763 void DictionaryValue::MergeDictionary(const DictionaryValue* dictionary) { 763 void DictionaryValue::MergeDictionary(const DictionaryValue* dictionary) {
764 for (DictionaryValue::Iterator it(*dictionary); !it.IsAtEnd(); it.Advance()) { 764 for (DictionaryValue::Iterator it(*dictionary); !it.IsAtEnd(); it.Advance()) {
765 const Value* merge_value = &it.value(); 765 const Value* merge_value = &it.value();
766 // Check whether we have to merge dictionaries. 766 // Check whether we have to merge dictionaries.
767 if (merge_value->IsType(Value::TYPE_DICTIONARY)) { 767 if (merge_value->IsType(Value::TYPE_DICTIONARY)) {
768 DictionaryValue* sub_dict; 768 DictionaryValue* sub_dict;
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1113
1114 std::ostream& operator<<(std::ostream& out, const Value& value) { 1114 std::ostream& operator<<(std::ostream& out, const Value& value) {
1115 std::string json; 1115 std::string json;
1116 JSONWriter::WriteWithOptions(&value, 1116 JSONWriter::WriteWithOptions(&value,
1117 JSONWriter::OPTIONS_PRETTY_PRINT, 1117 JSONWriter::OPTIONS_PRETTY_PRINT,
1118 &json); 1118 &json);
1119 return out << json; 1119 return out << json;
1120 } 1120 }
1121 1121
1122 } // namespace base 1122 } // namespace base
OLDNEW
« no previous file with comments | « base/values.h ('k') | chrome/browser/prefs/pref_metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698