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

Side by Side Diff: chrome/browser/chromeos/drive/drive_resource_metadata.cc

Issue 11876002: Make largest_changestamp setter/getter asynchronous. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: added unit test Created 7 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
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/chromeos/drive/drive_resource_metadata.h" 5 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h"
6 6
7 #include <leveldb/db.h> 7 #include <leveldb/db.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // so we need to delete them here. 223 // so we need to delete them here.
224 root_->RemoveChildren(); 224 root_->RemoveChildren();
225 RemoveEntryFromResourceMap(root_->resource_id()); 225 RemoveEntryFromResourceMap(root_->resource_id());
226 DCHECK(resource_map_.empty()); 226 DCHECK(resource_map_.empty());
227 // The resource_map_ should be empty here, but to make sure for non-Debug 227 // The resource_map_ should be empty here, but to make sure for non-Debug
228 // build. 228 // build.
229 resource_map_.clear(); 229 resource_map_.clear();
230 root_.reset(); 230 root_.reset();
231 } 231 }
232 232
233 void DriveResourceMetadata::GetLargestChangestamp(
234 const GetChangestampCallback& callback) {
235 base::MessageLoopProxy::current()->PostTask(
236 FROM_HERE, base::Bind(callback, largest_changestamp_));
237 }
238
239 void DriveResourceMetadata::SetLargestChangestamp(
240 int64 value,
241 const FileOperationCallback& callback) {
242 largest_changestamp_ = value;
243 base::MessageLoopProxy::current()->PostTask(
244 FROM_HERE, base::Bind(callback, DRIVE_FILE_OK));
245 }
246
233 void DriveResourceMetadata::AddEntryToDirectory( 247 void DriveResourceMetadata::AddEntryToDirectory(
234 const FilePath& directory_path, 248 const FilePath& directory_path,
235 scoped_ptr<google_apis::ResourceEntry> entry, 249 scoped_ptr<google_apis::ResourceEntry> entry,
236 const FileMoveCallback& callback) { 250 const FileMoveCallback& callback) {
237 DCHECK(!directory_path.empty()); 251 DCHECK(!directory_path.empty());
238 DCHECK(!callback.is_null()); 252 DCHECK(!callback.is_null());
239 253
240 if (!entry.get()) { 254 if (!entry.get()) {
241 PostFileMoveCallbackError(callback, DRIVE_FILE_ERROR_FAILED); 255 PostFileMoveCallbackError(callback, DRIVE_FILE_ERROR_FAILED);
242 return; 256 return;
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 DCHECK(result.get()); 936 DCHECK(result.get());
923 937
924 result->second.path = second_path; 938 result->second.path = second_path;
925 result->second.error = error; 939 result->second.error = error;
926 result->second.proto = entry_proto.Pass(); 940 result->second.proto = entry_proto.Pass();
927 941
928 callback.Run(result.Pass()); 942 callback.Run(result.Pass());
929 } 943 }
930 944
931 } // namespace drive 945 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698