OLD | NEW |
---|---|
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/chromeos/gdata/gdata_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 } | 191 } |
192 | 192 |
193 // Gets a cache entry from a GDataCache, must be called on the blocking pool. | 193 // Gets a cache entry from a GDataCache, must be called on the blocking pool. |
194 // The result value is copied to cache_entry on success. | 194 // The result value is copied to cache_entry on success. |
195 void GetCacheEntryOnBlockingPool( | 195 void GetCacheEntryOnBlockingPool( |
196 GDataCache* cache, | 196 GDataCache* cache, |
197 const std::string& resource_id, | 197 const std::string& resource_id, |
198 const std::string& md5, | 198 const std::string& md5, |
199 GDataCache::CacheEntry* cache_entry, | 199 GDataCache::CacheEntry* cache_entry, |
200 bool* success) { | 200 bool* success) { |
201 scoped_ptr<GDataCache::CacheEntry> value( | 201 *success = cache->GetCacheEntry(resource_id, md5, cache_entry); |
satorux1
2012/06/20 15:29:23
nice! it's simpler
| |
202 cache->GetCacheEntry(resource_id, md5)); | |
203 *success = value.get(); | |
204 if (*success) | |
205 *cache_entry = *value; | |
206 } | 202 } |
207 | 203 |
208 // Runs GetFileCallback with pointers dereferenced. | 204 // Runs GetFileCallback with pointers dereferenced. |
209 // Used for PostTaskAndReply(). | 205 // Used for PostTaskAndReply(). |
210 void RunGetFileCallbackHelper(const GetFileCallback& callback, | 206 void RunGetFileCallbackHelper(const GetFileCallback& callback, |
211 base::PlatformFileError* error, | 207 base::PlatformFileError* error, |
212 FilePath* file_path, | 208 FilePath* file_path, |
213 std::string* mime_type, | 209 std::string* mime_type, |
214 GDataFileType* file_type) { | 210 GDataFileType* file_type) { |
215 DCHECK(error); | 211 DCHECK(error); |
(...skipping 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3719 // must go through here. Removes the |file_path| from the remembered set so | 3715 // must go through here. Removes the |file_path| from the remembered set so |
3720 // that subsequent operations can open the file again. | 3716 // that subsequent operations can open the file again. |
3721 open_files_.erase(file_path); | 3717 open_files_.erase(file_path); |
3722 | 3718 |
3723 // Then invokes the user-supplied callback function. | 3719 // Then invokes the user-supplied callback function. |
3724 if (!callback.is_null()) | 3720 if (!callback.is_null()) |
3725 callback.Run(result); | 3721 callback.Run(result); |
3726 } | 3722 } |
3727 | 3723 |
3728 } // namespace gdata | 3724 } // namespace gdata |
OLD | NEW |