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

Side by Side Diff: third_party/libaddressinput/chromium/chrome_storage_impl.cc

Issue 132723003: [rAc - i18n] don't call callbacks on Storage destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "third_party/libaddressinput/chromium/chrome_storage_impl.h" 5 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h"
6 6
7 #include "base/prefs/writeable_pref_store.h" 7 #include "base/prefs/writeable_pref_store.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 9
10 ChromeStorageImpl::ChromeStorageImpl(WriteablePrefStore* store) 10 ChromeStorageImpl::ChromeStorageImpl(WriteablePrefStore* store)
11 : backing_store_(store), 11 : backing_store_(store),
12 scoped_observer_(this) { 12 scoped_observer_(this) {
13 scoped_observer_.Add(backing_store_); 13 scoped_observer_.Add(backing_store_);
14 } 14 }
15 15
16 ChromeStorageImpl::~ChromeStorageImpl() { 16 ChromeStorageImpl::~ChromeStorageImpl() {}
17 // TODO(estade): this shouldn't be necessary.
18 for (std::vector<Request*>::iterator iter =
19 outstanding_requests_.begin();
20 iter != outstanding_requests_.end(); ++iter) {
21 (*(*iter)->callback)(false, (*iter)->key, std::string());
22 }
23 }
24 17
25 void ChromeStorageImpl::Put(const std::string& key, const std::string& data) { 18 void ChromeStorageImpl::Put(const std::string& key, const std::string& data) {
26 backing_store_->SetValue(key, new base::StringValue(data)); 19 backing_store_->SetValue(key, new base::StringValue(data));
27 } 20 }
28 21
29 void ChromeStorageImpl::Get( 22 void ChromeStorageImpl::Get(
30 const std::string& key, 23 const std::string& key,
31 scoped_ptr<Storage::Callback> data_ready) const { 24 scoped_ptr<Storage::Callback> data_ready) const {
32 // |Get()| should not be const, so this is just a thunk that fixes that. 25 // |Get()| should not be const, so this is just a thunk that fixes that.
33 const_cast<ChromeStorageImpl*>(this)->DoGet(key, data_ready.Pass()); 26 const_cast<ChromeStorageImpl*>(this)->DoGet(key, data_ready.Pass());
(...skipping 27 matching lines...) Expand all
61 (*data_ready)(true, key, result); 54 (*data_ready)(true, key, result);
62 } else { 55 } else {
63 (*data_ready)(false, key, std::string()); 56 (*data_ready)(false, key, std::string());
64 } 57 }
65 } 58 }
66 59
67 ChromeStorageImpl::Request::Request(const std::string& key, 60 ChromeStorageImpl::Request::Request(const std::string& key,
68 scoped_ptr<Storage::Callback> callback) 61 scoped_ptr<Storage::Callback> callback)
69 : key(key), 62 : key(key),
70 callback(callback.Pass()) {} 63 callback(callback.Pass()) {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698