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 <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 LoadRootFeedFromCache(search_file_path, | 517 LoadRootFeedFromCache(search_file_path, |
518 true, // should_load_from_server | 518 true, // should_load_from_server |
519 callback); | 519 callback); |
520 return; | 520 return; |
521 } else if (root_->NeedsRefresh()) { | 521 } else if (root_->NeedsRefresh()) { |
522 // If content is stale or from disk from cache, fetch content from | 522 // If content is stale or from disk from cache, fetch content from |
523 // the server. | 523 // the server. |
524 LoadFeedFromServer(search_file_path, callback); | 524 LoadFeedFromServer(search_file_path, callback); |
525 return; | 525 return; |
526 } | 526 } |
527 GDataFileSystem::FindFileByPathOnCallingThread( | 527 |
528 search_file_path, | 528 // Post a task to the same thread, rather than calling it here, as |
529 callback); | 529 // FindFileByPathAsync() is asynchronous. |
530 base::MessageLoopProxy::current()->PostTask( | |
Ben Chan
2012/03/26 16:28:42
Let's look into a better way to handle the lock bu
| |
531 FROM_HERE, | |
532 base::Bind(&GDataFileSystem::FindFileByPathOnCallingThread, | |
533 GetWeakPtrForCurrentThread(), | |
534 search_file_path, | |
535 callback)); | |
530 } | 536 } |
531 | 537 |
532 void GDataFileSystem::FindFileByPathOnCallingThread( | 538 void GDataFileSystem::FindFileByPathOnCallingThread( |
533 const FilePath& search_file_path, | 539 const FilePath& search_file_path, |
534 const FindFileCallback& callback) { | 540 const FindFileCallback& callback) { |
535 FindFileCallbackRelayDelegate delegate(callback); | 541 FindFileCallbackRelayDelegate delegate(callback); |
536 FindFileByPathSync(search_file_path, &delegate); | 542 FindFileByPathSync(search_file_path, &delegate); |
537 } | 543 } |
538 | 544 |
539 void GDataFileSystem::LoadFeedFromServer( | 545 void GDataFileSystem::LoadFeedFromServer( |
(...skipping 3022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3562 const bool posted = BrowserThread::PostTask( | 3568 const bool posted = BrowserThread::PostTask( |
3563 BrowserThread::FILE, | 3569 BrowserThread::FILE, |
3564 from_here, | 3570 from_here, |
3565 base::Bind(&GDataFileSystem::RunTaskOnIOThreadPool, | 3571 base::Bind(&GDataFileSystem::RunTaskOnIOThreadPool, |
3566 base::Unretained(this), | 3572 base::Unretained(this), |
3567 task)); | 3573 task)); |
3568 DCHECK(posted); | 3574 DCHECK(posted); |
3569 } | 3575 } |
3570 | 3576 |
3571 } // namespace gdata | 3577 } // namespace gdata |
OLD | NEW |