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

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: 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
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 bool rv = storage_.GetWithoutPathExpansion(it.key(), &old_value);
102 DCHECK(rv);
Mattias Nissler (ping if slow) 2012/07/26 09:37:06 Same thing, this may return false, in which case o
102 if (!old_value || !old_value->Equals(&it.value())) { 103 if (!old_value || !old_value->Equals(&it.value())) {
Joao da Silva 2012/07/26 10:04:33 As Mattias mentioned, the DCHECK is wrong. Maybe r
Danh Nguyen 2012/07/26 15:46:27 Fixed. Thanks Joao for your suggestion.
103 changes->push_back( 104 changes->push_back(
104 ValueStoreChange( 105 ValueStoreChange(
105 it.key(), 106 it.key(),
106 old_value ? old_value->DeepCopy() : old_value, 107 old_value ? old_value->DeepCopy() : old_value,
107 it.value().DeepCopy())); 108 it.value().DeepCopy()));
108 storage_.SetWithoutPathExpansion(it.key(), it.value().DeepCopy()); 109 storage_.SetWithoutPathExpansion(it.key(), it.value().DeepCopy());
109 } 110 }
110 } 111 }
111 return MakeWriteResult(changes.release()); 112 return MakeWriteResult(changes.release());
112 } 113 }
(...skipping 24 matching lines...) Expand all
137 if (fail_all_requests_) { 138 if (fail_all_requests_) {
138 return WriteResultError(); 139 return WriteResultError();
139 } 140 }
140 141
141 std::vector<std::string> keys; 142 std::vector<std::string> keys;
142 for (DictionaryValue::Iterator it(storage_); it.HasNext(); it.Advance()) { 143 for (DictionaryValue::Iterator it(storage_); it.HasNext(); it.Advance()) {
143 keys.push_back(it.key()); 144 keys.push_back(it.key());
144 } 145 }
145 return Remove(keys); 146 return Remove(keys);
146 } 147 }
OLDNEW
« chrome/browser/policy/policy_loader_win.cc ('K') | « 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