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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/create_directory_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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/create_directory_operation.h " 5 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h "
6 6
7 #include "chrome/browser/chromeos/drive/drive.pb.h" 7 #include "chrome/browser/chromeos/drive/drive.pb.h"
8 #include "chrome/browser/chromeos/drive/file_change.h" 8 #include "chrome/browser/chromeos/drive/file_change.h"
9 #include "chrome/browser/chromeos/drive/file_system/operation_delegate.h" 9 #include "chrome/browser/chromeos/drive/file_system/operation_delegate.h"
10 #include "chrome/browser/chromeos/drive/file_system_util.h" 10 #include "chrome/browser/chromeos/drive/file_system_util.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } // namespace 121 } // namespace
122 122
123 CreateDirectoryOperation::CreateDirectoryOperation( 123 CreateDirectoryOperation::CreateDirectoryOperation(
124 base::SequencedTaskRunner* blocking_task_runner, 124 base::SequencedTaskRunner* blocking_task_runner,
125 OperationDelegate* delegate, 125 OperationDelegate* delegate,
126 internal::ResourceMetadata* metadata) 126 internal::ResourceMetadata* metadata)
127 : blocking_task_runner_(blocking_task_runner), 127 : blocking_task_runner_(blocking_task_runner),
128 delegate_(delegate), 128 delegate_(delegate),
129 metadata_(metadata), 129 metadata_(metadata),
130 weak_ptr_factory_(this) { 130 weak_ptr_factory_(this) {
131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 131 DCHECK_CURRENTLY_ON(BrowserThread::UI);
132 } 132 }
133 133
134 CreateDirectoryOperation::~CreateDirectoryOperation() { 134 CreateDirectoryOperation::~CreateDirectoryOperation() {
135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 135 DCHECK_CURRENTLY_ON(BrowserThread::UI);
136 } 136 }
137 137
138 void CreateDirectoryOperation::CreateDirectory( 138 void CreateDirectoryOperation::CreateDirectory(
139 const base::FilePath& directory_path, 139 const base::FilePath& directory_path,
140 bool is_exclusive, 140 bool is_exclusive,
141 bool is_recursive, 141 bool is_recursive,
142 const FileOperationCallback& callback) { 142 const FileOperationCallback& callback) {
143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 143 DCHECK_CURRENTLY_ON(BrowserThread::UI);
144 DCHECK(!callback.is_null()); 144 DCHECK(!callback.is_null());
145 145
146 std::set<std::string>* updated_local_ids = new std::set<std::string>; 146 std::set<std::string>* updated_local_ids = new std::set<std::string>;
147 FileChange* changed_files(new FileChange); 147 FileChange* changed_files(new FileChange);
148 base::PostTaskAndReplyWithResult( 148 base::PostTaskAndReplyWithResult(
149 blocking_task_runner_.get(), 149 blocking_task_runner_.get(),
150 FROM_HERE, 150 FROM_HERE,
151 base::Bind(&UpdateLocalState, 151 base::Bind(&UpdateLocalState,
152 metadata_, 152 metadata_,
153 directory_path, 153 directory_path,
154 is_exclusive, 154 is_exclusive,
155 is_recursive, 155 is_recursive,
156 updated_local_ids, 156 updated_local_ids,
157 changed_files), 157 changed_files),
158 base::Bind( 158 base::Bind(
159 &CreateDirectoryOperation::CreateDirectoryAfterUpdateLocalState, 159 &CreateDirectoryOperation::CreateDirectoryAfterUpdateLocalState,
160 weak_ptr_factory_.GetWeakPtr(), 160 weak_ptr_factory_.GetWeakPtr(),
161 callback, 161 callback,
162 base::Owned(updated_local_ids), 162 base::Owned(updated_local_ids),
163 base::Owned(changed_files))); 163 base::Owned(changed_files)));
164 } 164 }
165 165
166 void CreateDirectoryOperation::CreateDirectoryAfterUpdateLocalState( 166 void CreateDirectoryOperation::CreateDirectoryAfterUpdateLocalState(
167 const FileOperationCallback& callback, 167 const FileOperationCallback& callback,
168 const std::set<std::string>* updated_local_ids, 168 const std::set<std::string>* updated_local_ids,
169 const FileChange* changed_files, 169 const FileChange* changed_files,
170 FileError error) { 170 FileError error) {
171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 171 DCHECK_CURRENTLY_ON(BrowserThread::UI);
172 DCHECK(!callback.is_null()); 172 DCHECK(!callback.is_null());
173 173
174 for (const auto& id : *updated_local_ids) { 174 for (const auto& id : *updated_local_ids) {
175 delegate_->OnEntryUpdatedByOperation(ClientContext(USER_INITIATED), id); 175 delegate_->OnEntryUpdatedByOperation(ClientContext(USER_INITIATED), id);
176 } 176 }
177 177
178 delegate_->OnFileChangedByOperation(*changed_files); 178 delegate_->OnFileChangedByOperation(*changed_files);
179 179
180 callback.Run(error); 180 callback.Run(error);
181 } 181 }
182 182
183 } // namespace file_system 183 } // namespace file_system
184 } // namespace drive 184 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698