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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/set_property_operation.cc

Issue 1036723003: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/file_system/set_property_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/set_property_operation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "chrome/browser/chromeos/drive/drive.pb.h" 10 #include "chrome/browser/chromeos/drive/drive.pb.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 SetPropertyOperation::~SetPropertyOperation() { 84 SetPropertyOperation::~SetPropertyOperation() {
85 } 85 }
86 86
87 void SetPropertyOperation::SetProperty( 87 void SetPropertyOperation::SetProperty(
88 const base::FilePath& file_path, 88 const base::FilePath& file_path,
89 google_apis::drive::Property::Visibility visibility, 89 google_apis::drive::Property::Visibility visibility,
90 const std::string& key, 90 const std::string& key,
91 const std::string& value, 91 const std::string& value,
92 const FileOperationCallback& callback) { 92 const FileOperationCallback& callback) {
93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 93 DCHECK_CURRENTLY_ON(BrowserThread::UI);
94 DCHECK(!callback.is_null()); 94 DCHECK(!callback.is_null());
95 95
96 ResourceEntry* entry = new ResourceEntry; 96 ResourceEntry* entry = new ResourceEntry;
97 base::PostTaskAndReplyWithResult( 97 base::PostTaskAndReplyWithResult(
98 blocking_task_runner_.get(), FROM_HERE, 98 blocking_task_runner_.get(), FROM_HERE,
99 base::Bind(&UpdateLocalState, metadata_, file_path, visibility, key, 99 base::Bind(&UpdateLocalState, metadata_, file_path, visibility, key,
100 value, entry), 100 value, entry),
101 base::Bind(&SetPropertyOperation::SetPropertyAfterUpdateLocalState, 101 base::Bind(&SetPropertyOperation::SetPropertyAfterUpdateLocalState,
102 weak_ptr_factory_.GetWeakPtr(), callback, base::Owned(entry))); 102 weak_ptr_factory_.GetWeakPtr(), callback, base::Owned(entry)));
103 } 103 }
104 104
105 void SetPropertyOperation::SetPropertyAfterUpdateLocalState( 105 void SetPropertyOperation::SetPropertyAfterUpdateLocalState(
106 const FileOperationCallback& callback, 106 const FileOperationCallback& callback,
107 const ResourceEntry* entry, 107 const ResourceEntry* entry,
108 FileError result) { 108 FileError result) {
109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 109 DCHECK_CURRENTLY_ON(BrowserThread::UI);
110 DCHECK(!callback.is_null()); 110 DCHECK(!callback.is_null());
111 111
112 if (result == FILE_ERROR_OK) { 112 if (result == FILE_ERROR_OK) {
113 // Do not notify about the file change, as properties are write only and 113 // Do not notify about the file change, as properties are write only and
114 // cannot be read, so there is no visible change. 114 // cannot be read, so there is no visible change.
115 delegate_->OnEntryUpdatedByOperation(ClientContext(USER_INITIATED), 115 delegate_->OnEntryUpdatedByOperation(ClientContext(USER_INITIATED),
116 entry->local_id()); 116 entry->local_id());
117 } 117 }
118 118
119 // Even if exists, return success, as the set property operation always 119 // Even if exists, return success, as the set property operation always
120 // overwrites existing values. 120 // overwrites existing values.
121 callback.Run(result == FILE_ERROR_EXISTS ? FILE_ERROR_OK : result); 121 callback.Run(result == FILE_ERROR_EXISTS ? FILE_ERROR_OK : result);
122 } 122 }
123 123
124 } // namespace file_system 124 } // namespace file_system
125 } // namespace drive 125 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698