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

Side by Side Diff: chrome/browser/chromeos/drive/drive_file_stream_reader.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/drive_file_stream_reader.h" 5 #include "chrome/browser/chromeos/drive/drive_file_stream_reader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return offset; 89 return offset;
90 } 90 }
91 91
92 } // namespace 92 } // namespace
93 93
94 LocalReaderProxy::LocalReaderProxy( 94 LocalReaderProxy::LocalReaderProxy(
95 scoped_ptr<util::LocalFileReader> file_reader, int64 length) 95 scoped_ptr<util::LocalFileReader> file_reader, int64 length)
96 : file_reader_(file_reader.Pass()), 96 : file_reader_(file_reader.Pass()),
97 remaining_length_(length), 97 remaining_length_(length),
98 weak_ptr_factory_(this) { 98 weak_ptr_factory_(this) {
99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 99 DCHECK_CURRENTLY_ON(BrowserThread::IO);
100 DCHECK(file_reader_); 100 DCHECK(file_reader_);
101 } 101 }
102 102
103 LocalReaderProxy::~LocalReaderProxy() { 103 LocalReaderProxy::~LocalReaderProxy() {
104 } 104 }
105 105
106 int LocalReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, 106 int LocalReaderProxy::Read(net::IOBuffer* buffer, int buffer_length,
107 const net::CompletionCallback& callback) { 107 const net::CompletionCallback& callback) {
108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 108 DCHECK_CURRENTLY_ON(BrowserThread::IO);
109 DCHECK(file_reader_); 109 DCHECK(file_reader_);
110 110
111 if (buffer_length > remaining_length_) { 111 if (buffer_length > remaining_length_) {
112 // Here, narrowing is safe. 112 // Here, narrowing is safe.
113 buffer_length = static_cast<int>(remaining_length_); 113 buffer_length = static_cast<int>(remaining_length_);
114 } 114 }
115 115
116 if (!buffer_length) 116 if (!buffer_length)
117 return 0; 117 return 0;
118 118
119 file_reader_->Read(buffer, buffer_length, 119 file_reader_->Read(buffer, buffer_length,
120 base::Bind(&LocalReaderProxy::OnReadCompleted, 120 base::Bind(&LocalReaderProxy::OnReadCompleted,
121 weak_ptr_factory_.GetWeakPtr(), callback)); 121 weak_ptr_factory_.GetWeakPtr(), callback));
122 return net::ERR_IO_PENDING; 122 return net::ERR_IO_PENDING;
123 } 123 }
124 124
125 void LocalReaderProxy::OnGetContent(scoped_ptr<std::string> data) { 125 void LocalReaderProxy::OnGetContent(scoped_ptr<std::string> data) {
126 // This method should never be called, because no data should be received 126 // This method should never be called, because no data should be received
127 // from the network during the reading of local-cache file. 127 // from the network during the reading of local-cache file.
128 NOTREACHED(); 128 NOTREACHED();
129 } 129 }
130 130
131 void LocalReaderProxy::OnCompleted(FileError error) { 131 void LocalReaderProxy::OnCompleted(FileError error) {
132 // If this method is called, no network error should be happened. 132 // If this method is called, no network error should be happened.
133 DCHECK_EQ(FILE_ERROR_OK, error); 133 DCHECK_EQ(FILE_ERROR_OK, error);
134 } 134 }
135 135
136 void LocalReaderProxy::OnReadCompleted(const net::CompletionCallback& callback, 136 void LocalReaderProxy::OnReadCompleted(const net::CompletionCallback& callback,
137 int read_result) { 137 int read_result) {
138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 138 DCHECK_CURRENTLY_ON(BrowserThread::IO);
139 DCHECK(file_reader_); 139 DCHECK(file_reader_);
140 140
141 if (read_result >= 0) { 141 if (read_result >= 0) {
142 // |read_result| bytes data is read. 142 // |read_result| bytes data is read.
143 DCHECK_LE(read_result, remaining_length_); 143 DCHECK_LE(read_result, remaining_length_);
144 remaining_length_ -= read_result; 144 remaining_length_ -= read_result;
145 } else { 145 } else {
146 // An error occurs. Close the |file_reader_|. 146 // An error occurs. Close the |file_reader_|.
147 file_reader_.reset(); 147 file_reader_.reset();
148 } 148 }
149 callback.Run(read_result); 149 callback.Run(read_result);
150 } 150 }
151 151
152 NetworkReaderProxy::NetworkReaderProxy( 152 NetworkReaderProxy::NetworkReaderProxy(
153 int64 offset, 153 int64 offset,
154 int64 content_length, 154 int64 content_length,
155 int64 full_content_length, 155 int64 full_content_length,
156 const base::Closure& job_canceller) 156 const base::Closure& job_canceller)
157 : remaining_offset_(offset), 157 : remaining_offset_(offset),
158 remaining_content_length_(content_length), 158 remaining_content_length_(content_length),
159 is_full_download_(offset + content_length == full_content_length), 159 is_full_download_(offset + content_length == full_content_length),
160 error_code_(net::OK), 160 error_code_(net::OK),
161 buffer_length_(0), 161 buffer_length_(0),
162 job_canceller_(job_canceller) { 162 job_canceller_(job_canceller) {
163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 163 DCHECK_CURRENTLY_ON(BrowserThread::IO);
164 } 164 }
165 165
166 NetworkReaderProxy::~NetworkReaderProxy() { 166 NetworkReaderProxy::~NetworkReaderProxy() {
167 if (!job_canceller_.is_null()) { 167 if (!job_canceller_.is_null()) {
168 job_canceller_.Run(); 168 job_canceller_.Run();
169 } 169 }
170 } 170 }
171 171
172 int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, 172 int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length,
173 const net::CompletionCallback& callback) { 173 const net::CompletionCallback& callback) {
174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 174 DCHECK_CURRENTLY_ON(BrowserThread::IO);
175 // Check if there is no pending Read operation. 175 // Check if there is no pending Read operation.
176 DCHECK(!buffer_.get()); 176 DCHECK(!buffer_.get());
177 DCHECK_EQ(buffer_length_, 0); 177 DCHECK_EQ(buffer_length_, 0);
178 DCHECK(callback_.is_null()); 178 DCHECK(callback_.is_null());
179 // Validate the arguments. 179 // Validate the arguments.
180 DCHECK(buffer); 180 DCHECK(buffer);
181 DCHECK_GT(buffer_length, 0); 181 DCHECK_GT(buffer_length, 0);
182 DCHECK(!callback.is_null()); 182 DCHECK(!callback.is_null());
183 183
184 if (error_code_ != net::OK) { 184 if (error_code_ != net::OK) {
(...skipping 26 matching lines...) Expand all
211 // Although OnCompleted() should reset |job_canceller_| when download is done, 211 // Although OnCompleted() should reset |job_canceller_| when download is done,
212 // due to timing issues the ReaderProxy instance may be destructed before the 212 // due to timing issues the ReaderProxy instance may be destructed before the
213 // notification. To fix the case we reset here earlier. 213 // notification. To fix the case we reset here earlier.
214 if (is_full_download_ && remaining_content_length_ == 0) 214 if (is_full_download_ && remaining_content_length_ == 0)
215 job_canceller_.Reset(); 215 job_canceller_.Reset();
216 216
217 return result; 217 return result;
218 } 218 }
219 219
220 void NetworkReaderProxy::OnGetContent(scoped_ptr<std::string> data) { 220 void NetworkReaderProxy::OnGetContent(scoped_ptr<std::string> data) {
221 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 221 DCHECK_CURRENTLY_ON(BrowserThread::IO);
222 DCHECK(data && !data->empty()); 222 DCHECK(data && !data->empty());
223 223
224 if (remaining_offset_ >= static_cast<int64>(data->length())) { 224 if (remaining_offset_ >= static_cast<int64>(data->length())) {
225 // Skip unneeded leading data. 225 // Skip unneeded leading data.
226 remaining_offset_ -= data->length(); 226 remaining_offset_ -= data->length();
227 return; 227 return;
228 } 228 }
229 229
230 if (remaining_offset_ > 0) { 230 if (remaining_offset_ > 0) {
231 // Erase unnecessary leading bytes. 231 // Erase unnecessary leading bytes.
(...skipping 14 matching lines...) Expand all
246 if (is_full_download_ && remaining_content_length_ == 0) 246 if (is_full_download_ && remaining_content_length_ == 0)
247 job_canceller_.Reset(); 247 job_canceller_.Reset();
248 248
249 buffer_ = NULL; 249 buffer_ = NULL;
250 buffer_length_ = 0; 250 buffer_length_ = 0;
251 DCHECK(!callback_.is_null()); 251 DCHECK(!callback_.is_null());
252 base::ResetAndReturn(&callback_).Run(result); 252 base::ResetAndReturn(&callback_).Run(result);
253 } 253 }
254 254
255 void NetworkReaderProxy::OnCompleted(FileError error) { 255 void NetworkReaderProxy::OnCompleted(FileError error) {
256 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 256 DCHECK_CURRENTLY_ON(BrowserThread::IO);
257 // The downloading is completed, so we do not need to cancel the job 257 // The downloading is completed, so we do not need to cancel the job
258 // in the destructor. 258 // in the destructor.
259 job_canceller_.Reset(); 259 job_canceller_.Reset();
260 260
261 if (error == FILE_ERROR_OK) { 261 if (error == FILE_ERROR_OK) {
262 return; 262 return;
263 } 263 }
264 264
265 error_code_ = FileErrorToNetError(error); 265 error_code_ = FileErrorToNetError(error);
266 pending_data_.clear(); 266 pending_data_.clear();
(...skipping 14 matching lines...) Expand all
281 281
282 // Calls FileSystemInterface::GetFileContent if the file system 282 // Calls FileSystemInterface::GetFileContent if the file system
283 // is available. If not, the |completion_callback| is invoked with 283 // is available. If not, the |completion_callback| is invoked with
284 // FILE_ERROR_FAILED. 284 // FILE_ERROR_FAILED.
285 base::Closure GetFileContentOnUIThread( 285 base::Closure GetFileContentOnUIThread(
286 const DriveFileStreamReader::FileSystemGetter& file_system_getter, 286 const DriveFileStreamReader::FileSystemGetter& file_system_getter,
287 const base::FilePath& drive_file_path, 287 const base::FilePath& drive_file_path,
288 const GetFileContentInitializedCallback& initialized_callback, 288 const GetFileContentInitializedCallback& initialized_callback,
289 const google_apis::GetContentCallback& get_content_callback, 289 const google_apis::GetContentCallback& get_content_callback,
290 const FileOperationCallback& completion_callback) { 290 const FileOperationCallback& completion_callback) {
291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 291 DCHECK_CURRENTLY_ON(BrowserThread::UI);
292 292
293 FileSystemInterface* file_system = file_system_getter.Run(); 293 FileSystemInterface* file_system = file_system_getter.Run();
294 if (!file_system) { 294 if (!file_system) {
295 completion_callback.Run(FILE_ERROR_FAILED); 295 completion_callback.Run(FILE_ERROR_FAILED);
296 return base::Closure(); 296 return base::Closure();
297 } 297 }
298 298
299 return google_apis::CreateRelayCallback( 299 return google_apis::CreateRelayCallback(
300 file_system->GetFileContent(drive_file_path, 300 file_system->GetFileContent(drive_file_path,
301 initialized_callback, 301 initialized_callback,
302 get_content_callback, 302 get_content_callback,
303 completion_callback)); 303 completion_callback));
304 } 304 }
305 305
306 // Helper to run FileSystemInterface::GetFileContent on UI thread. 306 // Helper to run FileSystemInterface::GetFileContent on UI thread.
307 void GetFileContent( 307 void GetFileContent(
308 const DriveFileStreamReader::FileSystemGetter& file_system_getter, 308 const DriveFileStreamReader::FileSystemGetter& file_system_getter,
309 const base::FilePath& drive_file_path, 309 const base::FilePath& drive_file_path,
310 const GetFileContentInitializedCallback& initialized_callback, 310 const GetFileContentInitializedCallback& initialized_callback,
311 const google_apis::GetContentCallback& get_content_callback, 311 const google_apis::GetContentCallback& get_content_callback,
312 const FileOperationCallback& completion_callback, 312 const FileOperationCallback& completion_callback,
313 const base::Callback<void(const base::Closure&)>& reply_callback) { 313 const base::Callback<void(const base::Closure&)>& reply_callback) {
314 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 314 DCHECK_CURRENTLY_ON(BrowserThread::IO);
315 315
316 BrowserThread::PostTaskAndReplyWithResult( 316 BrowserThread::PostTaskAndReplyWithResult(
317 BrowserThread::UI, 317 BrowserThread::UI,
318 FROM_HERE, 318 FROM_HERE,
319 base::Bind(&GetFileContentOnUIThread, 319 base::Bind(&GetFileContentOnUIThread,
320 file_system_getter, 320 file_system_getter,
321 drive_file_path, 321 drive_file_path,
322 google_apis::CreateRelayCallback(initialized_callback), 322 google_apis::CreateRelayCallback(initialized_callback),
323 google_apis::CreateRelayCallback(get_content_callback), 323 google_apis::CreateRelayCallback(get_content_callback),
324 google_apis::CreateRelayCallback(completion_callback)), 324 google_apis::CreateRelayCallback(completion_callback)),
325 reply_callback); 325 reply_callback);
326 } 326 }
327 327
328 } // namespace 328 } // namespace
329 329
330 DriveFileStreamReader::DriveFileStreamReader( 330 DriveFileStreamReader::DriveFileStreamReader(
331 const FileSystemGetter& file_system_getter, 331 const FileSystemGetter& file_system_getter,
332 base::SequencedTaskRunner* file_task_runner) 332 base::SequencedTaskRunner* file_task_runner)
333 : file_system_getter_(file_system_getter), 333 : file_system_getter_(file_system_getter),
334 file_task_runner_(file_task_runner), 334 file_task_runner_(file_task_runner),
335 weak_ptr_factory_(this) { 335 weak_ptr_factory_(this) {
336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 336 DCHECK_CURRENTLY_ON(BrowserThread::IO);
337 } 337 }
338 338
339 DriveFileStreamReader::~DriveFileStreamReader() { 339 DriveFileStreamReader::~DriveFileStreamReader() {
340 } 340 }
341 341
342 bool DriveFileStreamReader::IsInitialized() const { 342 bool DriveFileStreamReader::IsInitialized() const {
343 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 343 DCHECK_CURRENTLY_ON(BrowserThread::IO);
344 return reader_proxy_.get() != NULL; 344 return reader_proxy_.get() != NULL;
345 } 345 }
346 346
347 void DriveFileStreamReader::Initialize( 347 void DriveFileStreamReader::Initialize(
348 const base::FilePath& drive_file_path, 348 const base::FilePath& drive_file_path,
349 const net::HttpByteRange& byte_range, 349 const net::HttpByteRange& byte_range,
350 const InitializeCompletionCallback& callback) { 350 const InitializeCompletionCallback& callback) {
351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 351 DCHECK_CURRENTLY_ON(BrowserThread::IO);
352 DCHECK(!callback.is_null()); 352 DCHECK(!callback.is_null());
353 353
354 GetFileContent( 354 GetFileContent(
355 file_system_getter_, 355 file_system_getter_,
356 drive_file_path, 356 drive_file_path,
357 base::Bind(&DriveFileStreamReader 357 base::Bind(&DriveFileStreamReader
358 ::InitializeAfterGetFileContentInitialized, 358 ::InitializeAfterGetFileContentInitialized,
359 weak_ptr_factory_.GetWeakPtr(), 359 weak_ptr_factory_.GetWeakPtr(),
360 byte_range, 360 byte_range,
361 callback), 361 callback),
362 base::Bind(&DriveFileStreamReader::OnGetContent, 362 base::Bind(&DriveFileStreamReader::OnGetContent,
363 weak_ptr_factory_.GetWeakPtr()), 363 weak_ptr_factory_.GetWeakPtr()),
364 base::Bind(&DriveFileStreamReader::OnGetFileContentCompletion, 364 base::Bind(&DriveFileStreamReader::OnGetFileContentCompletion,
365 weak_ptr_factory_.GetWeakPtr(), 365 weak_ptr_factory_.GetWeakPtr(),
366 callback), 366 callback),
367 base::Bind(&DriveFileStreamReader::StoreCancelDownloadClosure, 367 base::Bind(&DriveFileStreamReader::StoreCancelDownloadClosure,
368 weak_ptr_factory_.GetWeakPtr())); 368 weak_ptr_factory_.GetWeakPtr()));
369 } 369 }
370 370
371 int DriveFileStreamReader::Read(net::IOBuffer* buffer, int buffer_length, 371 int DriveFileStreamReader::Read(net::IOBuffer* buffer, int buffer_length,
372 const net::CompletionCallback& callback) { 372 const net::CompletionCallback& callback) {
373 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 373 DCHECK_CURRENTLY_ON(BrowserThread::IO);
374 DCHECK(reader_proxy_); 374 DCHECK(reader_proxy_);
375 DCHECK(buffer); 375 DCHECK(buffer);
376 DCHECK(!callback.is_null()); 376 DCHECK(!callback.is_null());
377 return reader_proxy_->Read(buffer, buffer_length, callback); 377 return reader_proxy_->Read(buffer, buffer_length, callback);
378 } 378 }
379 379
380 void DriveFileStreamReader::StoreCancelDownloadClosure( 380 void DriveFileStreamReader::StoreCancelDownloadClosure(
381 const base::Closure& cancel_download_closure) { 381 const base::Closure& cancel_download_closure) {
382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 382 DCHECK_CURRENTLY_ON(BrowserThread::IO);
383 cancel_download_closure_ = cancel_download_closure; 383 cancel_download_closure_ = cancel_download_closure;
384 } 384 }
385 385
386 void DriveFileStreamReader::InitializeAfterGetFileContentInitialized( 386 void DriveFileStreamReader::InitializeAfterGetFileContentInitialized(
387 const net::HttpByteRange& byte_range, 387 const net::HttpByteRange& byte_range,
388 const InitializeCompletionCallback& callback, 388 const InitializeCompletionCallback& callback,
389 FileError error, 389 FileError error,
390 const base::FilePath& local_cache_file_path, 390 const base::FilePath& local_cache_file_path,
391 scoped_ptr<ResourceEntry> entry) { 391 scoped_ptr<ResourceEntry> entry) {
392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 392 DCHECK_CURRENTLY_ON(BrowserThread::IO);
393 // StoreCancelDownloadClosure() should be called before this function. 393 // StoreCancelDownloadClosure() should be called before this function.
394 DCHECK(!cancel_download_closure_.is_null()); 394 DCHECK(!cancel_download_closure_.is_null());
395 395
396 if (error != FILE_ERROR_OK) { 396 if (error != FILE_ERROR_OK) {
397 callback.Run(FileErrorToNetError(error), scoped_ptr<ResourceEntry>()); 397 callback.Run(FileErrorToNetError(error), scoped_ptr<ResourceEntry>());
398 return; 398 return;
399 } 399 }
400 DCHECK(entry); 400 DCHECK(entry);
401 401
402 int64 range_start = 0, range_length = 0; 402 int64 range_start = 0, range_length = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 base::Passed(&entry), 438 base::Passed(&entry),
439 base::Passed(&file_reader))); 439 base::Passed(&file_reader)));
440 } 440 }
441 441
442 void DriveFileStreamReader::InitializeAfterLocalFileOpen( 442 void DriveFileStreamReader::InitializeAfterLocalFileOpen(
443 int64 length, 443 int64 length,
444 const InitializeCompletionCallback& callback, 444 const InitializeCompletionCallback& callback,
445 scoped_ptr<ResourceEntry> entry, 445 scoped_ptr<ResourceEntry> entry,
446 scoped_ptr<util::LocalFileReader> file_reader, 446 scoped_ptr<util::LocalFileReader> file_reader,
447 int open_result) { 447 int open_result) {
448 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 448 DCHECK_CURRENTLY_ON(BrowserThread::IO);
449 449
450 if (open_result != net::OK) { 450 if (open_result != net::OK) {
451 callback.Run(net::ERR_FAILED, scoped_ptr<ResourceEntry>()); 451 callback.Run(net::ERR_FAILED, scoped_ptr<ResourceEntry>());
452 return; 452 return;
453 } 453 }
454 454
455 reader_proxy_.reset( 455 reader_proxy_.reset(
456 new internal::LocalReaderProxy(file_reader.Pass(), length)); 456 new internal::LocalReaderProxy(file_reader.Pass(), length));
457 callback.Run(net::OK, entry.Pass()); 457 callback.Run(net::OK, entry.Pass());
458 } 458 }
459 459
460 void DriveFileStreamReader::OnGetContent( 460 void DriveFileStreamReader::OnGetContent(
461 google_apis::DriveApiErrorCode error_code, 461 google_apis::DriveApiErrorCode error_code,
462 scoped_ptr<std::string> data) { 462 scoped_ptr<std::string> data) {
463 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 463 DCHECK_CURRENTLY_ON(BrowserThread::IO);
464 DCHECK(reader_proxy_); 464 DCHECK(reader_proxy_);
465 reader_proxy_->OnGetContent(data.Pass()); 465 reader_proxy_->OnGetContent(data.Pass());
466 } 466 }
467 467
468 void DriveFileStreamReader::OnGetFileContentCompletion( 468 void DriveFileStreamReader::OnGetFileContentCompletion(
469 const InitializeCompletionCallback& callback, 469 const InitializeCompletionCallback& callback,
470 FileError error) { 470 FileError error) {
471 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 471 DCHECK_CURRENTLY_ON(BrowserThread::IO);
472 472
473 if (reader_proxy_) { 473 if (reader_proxy_) {
474 // If the proxy object available, send the error to it. 474 // If the proxy object available, send the error to it.
475 reader_proxy_->OnCompleted(error); 475 reader_proxy_->OnCompleted(error);
476 } else { 476 } else {
477 // Here the proxy object is not yet available. 477 // Here the proxy object is not yet available.
478 // There are two cases. 1) Some error happens during the initialization. 478 // There are two cases. 1) Some error happens during the initialization.
479 // 2) the cache file is found, but the proxy object is not *yet* 479 // 2) the cache file is found, but the proxy object is not *yet*
480 // initialized because the file is being opened. 480 // initialized because the file is being opened.
481 // We are interested in 1) only. The callback for 2) will be called 481 // We are interested in 1) only. The callback for 2) will be called
482 // after opening the file is completed. 482 // after opening the file is completed.
483 // Note: due to the same reason, LocalReaderProxy::OnCompleted may 483 // Note: due to the same reason, LocalReaderProxy::OnCompleted may
484 // or may not be called. This is timing issue, and it is difficult to avoid 484 // or may not be called. This is timing issue, and it is difficult to avoid
485 // unfortunately. 485 // unfortunately.
486 if (error != FILE_ERROR_OK) { 486 if (error != FILE_ERROR_OK) {
487 callback.Run(FileErrorToNetError(error), scoped_ptr<ResourceEntry>()); 487 callback.Run(FileErrorToNetError(error), scoped_ptr<ResourceEntry>());
488 } 488 }
489 } 489 }
490 } 490 }
491 491
492 } // namespace drive 492 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/download_handler.cc ('k') | chrome/browser/chromeos/drive/drive_integration_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698