OLD | NEW |
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 "extensions/browser/value_store/value_store_frontend.h" | 5 #include "extensions/browser/value_store/value_store_frontend.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(Backend); | 106 DISALLOW_COPY_AND_ASSIGN(Backend); |
107 }; | 107 }; |
108 | 108 |
109 ValueStoreFrontend::ValueStoreFrontend( | 109 ValueStoreFrontend::ValueStoreFrontend( |
110 const scoped_refptr<ValueStoreFactory>& store_factory, | 110 const scoped_refptr<ValueStoreFactory>& store_factory, |
111 BackendType backend_type) | 111 BackendType backend_type) |
112 : backend_(new Backend(store_factory, backend_type)) {} | 112 : backend_(new Backend(store_factory, backend_type)) {} |
113 | 113 |
114 ValueStoreFrontend::~ValueStoreFrontend() { | 114 ValueStoreFrontend::~ValueStoreFrontend() { |
115 DCHECK(CalledOnValidThread()); | 115 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
116 } | 116 } |
117 | 117 |
118 void ValueStoreFrontend::Get(const std::string& key, | 118 void ValueStoreFrontend::Get(const std::string& key, |
119 const ReadCallback& callback) { | 119 const ReadCallback& callback) { |
120 DCHECK(CalledOnValidThread()); | 120 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
121 | 121 |
122 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 122 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
123 base::Bind(&ValueStoreFrontend::Backend::Get, | 123 base::Bind(&ValueStoreFrontend::Backend::Get, |
124 backend_, key, callback)); | 124 backend_, key, callback)); |
125 } | 125 } |
126 | 126 |
127 void ValueStoreFrontend::Set(const std::string& key, | 127 void ValueStoreFrontend::Set(const std::string& key, |
128 std::unique_ptr<base::Value> value) { | 128 std::unique_ptr<base::Value> value) { |
129 DCHECK(CalledOnValidThread()); | 129 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
130 | 130 |
131 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 131 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
132 base::Bind(&ValueStoreFrontend::Backend::Set, | 132 base::Bind(&ValueStoreFrontend::Backend::Set, |
133 backend_, key, base::Passed(&value))); | 133 backend_, key, base::Passed(&value))); |
134 } | 134 } |
135 | 135 |
136 void ValueStoreFrontend::Remove(const std::string& key) { | 136 void ValueStoreFrontend::Remove(const std::string& key) { |
137 DCHECK(CalledOnValidThread()); | 137 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
138 | 138 |
139 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 139 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
140 base::Bind(&ValueStoreFrontend::Backend::Remove, | 140 base::Bind(&ValueStoreFrontend::Backend::Remove, |
141 backend_, key)); | 141 backend_, key)); |
142 } | 142 } |
OLD | NEW |