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

Side by Side Diff: chrome/browser/value_store/testing_value_store.cc

Issue 10830022: Fixed check return warnings from Coverity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a nit: adding braces. Created 8 years, 5 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 | « chrome/browser/policy/policy_loader_win.cc ('k') | no next file » | 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 "chrome/browser/value_store/testing_value_store.h" 5 #include "chrome/browser/value_store/testing_value_store.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 ValueStore::WriteResult TestingValueStore::Set( 92 ValueStore::WriteResult TestingValueStore::Set(
93 WriteOptions options, const DictionaryValue& settings) { 93 WriteOptions options, const DictionaryValue& settings) {
94 if (fail_all_requests_) { 94 if (fail_all_requests_) {
95 return WriteResultError(); 95 return WriteResultError();
96 } 96 }
97 97
98 scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList()); 98 scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
99 for (DictionaryValue::Iterator it(settings); it.HasNext(); it.Advance()) { 99 for (DictionaryValue::Iterator it(settings); it.HasNext(); it.Advance()) {
100 Value* old_value = NULL; 100 Value* old_value = NULL;
101 storage_.GetWithoutPathExpansion(it.key(), &old_value); 101 if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
102 if (!old_value || !old_value->Equals(&it.value())) { 102 !old_value->Equals(&it.value())) {
103 changes->push_back( 103 changes->push_back(
104 ValueStoreChange( 104 ValueStoreChange(
105 it.key(), 105 it.key(),
106 old_value ? old_value->DeepCopy() : old_value, 106 old_value ? old_value->DeepCopy() : old_value,
107 it.value().DeepCopy())); 107 it.value().DeepCopy()));
108 storage_.SetWithoutPathExpansion(it.key(), it.value().DeepCopy()); 108 storage_.SetWithoutPathExpansion(it.key(), it.value().DeepCopy());
109 } 109 }
110 } 110 }
111 return MakeWriteResult(changes.release()); 111 return MakeWriteResult(changes.release());
112 } 112 }
(...skipping 24 matching lines...) Expand all
137 if (fail_all_requests_) { 137 if (fail_all_requests_) {
138 return WriteResultError(); 138 return WriteResultError();
139 } 139 }
140 140
141 std::vector<std::string> keys; 141 std::vector<std::string> keys;
142 for (DictionaryValue::Iterator it(storage_); it.HasNext(); it.Advance()) { 142 for (DictionaryValue::Iterator it(storage_); it.HasNext(); it.Advance()) {
143 keys.push_back(it.key()); 143 keys.push_back(it.key());
144 } 144 }
145 return Remove(keys); 145 return Remove(keys);
146 } 146 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_loader_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698