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

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

Issue 24021002: Propagate more information about ValueStore errors to callers, notably an (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add Pass*() 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
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/value_store_frontend.h" 5 #include "chrome/browser/value_store/value_store_frontend.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 34
35 void Get(const std::string& key, 35 void Get(const std::string& key,
36 const ValueStoreFrontend::ReadCallback& callback) { 36 const ValueStoreFrontend::ReadCallback& callback) {
37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
38 ValueStore::ReadResult result = storage_->Get(key); 38 ValueStore::ReadResult result = storage_->Get(key);
39 39
40 // Extract the value from the ReadResult and pass ownership of it to the 40 // Extract the value from the ReadResult and pass ownership of it to the
41 // callback. 41 // callback.
42 scoped_ptr<base::Value> value; 42 scoped_ptr<base::Value> value;
43 if (!result->HasError()) { 43 if (!result->HasError()) {
44 result->settings()->RemoveWithoutPathExpansion(key, &value); 44 result->settings().RemoveWithoutPathExpansion(key, &value);
45 } else { 45 } else {
46 LOG(INFO) << "Reading " << key << " from " << db_path_.value() 46 LOG(WARNING) << "Reading " << key << " from " << db_path_.value()
47 << " failed: " << result->error(); 47 << " failed: " << result->error().message;
48 } 48 }
49 49
50 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 50 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
51 base::Bind(&ValueStoreFrontend::Backend::RunCallback, 51 base::Bind(&ValueStoreFrontend::Backend::RunCallback,
52 this, callback, base::Passed(&value))); 52 this, callback, base::Passed(&value)));
53 } 53 }
54 54
55 void Set(const std::string& key, scoped_ptr<base::Value> value) { 55 void Set(const std::string& key, scoped_ptr<base::Value> value) {
56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
57 // We don't need the old value, so skip generating changes. 57 // We don't need the old value, so skip generating changes.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 backend_, key, base::Passed(&value))); 134 backend_, key, base::Passed(&value)));
135 } 135 }
136 136
137 void ValueStoreFrontend::Remove(const std::string& key) { 137 void ValueStoreFrontend::Remove(const std::string& key) {
138 DCHECK(CalledOnValidThread()); 138 DCHECK(CalledOnValidThread());
139 139
140 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 140 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
141 base::Bind(&ValueStoreFrontend::Backend::Remove, 141 base::Bind(&ValueStoreFrontend::Backend::Remove,
142 backend_, key)); 142 backend_, key));
143 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/value_store/value_store.cc ('k') | chrome/browser/value_store/value_store_frontend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698