Index: chrome/browser/chromeos/gdata/gdata_file_system.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
index b333cc4e705c41f953388a332606ae9a4f55689e..6bbf982b619df0eb68a0131f987719179b7ee44d 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
@@ -1059,7 +1059,7 @@ void GDataFileSystem::FindEntryByPathAsyncOnUIThread( |
// the end of the initialization. |
AddObserver(new InitialLoadObserver( |
this, |
- base::Bind(&GDataFileSystem::FindEntryByPathOnCallingThread, |
+ base::Bind(&GDataFileSystem::FindEntryByPathSyncOnUIThread, |
ui_weak_ptr_, |
search_file_path, |
callback))); |
@@ -1088,15 +1088,18 @@ void GDataFileSystem::FindEntryByPathAsyncOnUIThread( |
// FindEntryByPathAsync() is asynchronous. |
base::MessageLoopProxy::current()->PostTask( |
FROM_HERE, |
- base::Bind(&GDataFileSystem::FindEntryByPathOnCallingThread, |
+ base::Bind(&GDataFileSystem::FindEntryByPathSyncOnUIThread, |
ui_weak_ptr_, |
search_file_path, |
callback)); |
} |
-void GDataFileSystem::FindEntryByPathOnCallingThread( |
+void GDataFileSystem::FindEntryByPathSyncOnUIThread( |
const FilePath& search_file_path, |
const FindEntryCallback& callback) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ base::AutoLock lock(lock_); // To access root_. |
FindEntryCallbackRelayDelegate delegate(callback); |
root_->FindEntryByPath(search_file_path, &delegate); |
} |
@@ -1126,6 +1129,8 @@ void GDataFileSystem::OnGetAccountMetadata( |
const FindEntryCallback& callback, |
GDataErrorCode status, |
scoped_ptr<base::Value> feed_data) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
base::PlatformFileError error = GDataToPlatformError(status); |
if (error != base::PLATFORM_FILE_OK) { |
// Get changes starting from the next changestamp from what we have locally. |
@@ -1160,7 +1165,7 @@ void GDataFileSystem::OnGetAccountMetadata( |
// No changes detected, continue with search as planned. |
if (!changes_detected) { |
if (!callback.is_null()) |
- FindEntryByPathOnCallingThread(search_file_path, callback); |
+ FindEntryByPathSyncOnUIThread(search_file_path, callback); |
NotifyInitialLoadFinished(); |
return; |
@@ -2691,7 +2696,7 @@ void GDataFileSystem::OnGetDocuments(GetDocumentsParams* params, |
// If we had someone to report this too, then this retrieval was done in a |
// context of search... so continue search. |
if (!params->callback.is_null()) { |
- FindEntryByPathOnCallingThread(params->search_file_path, params->callback); |
+ FindEntryByPathSyncOnUIThread(params->search_file_path, params->callback); |
} |
} |
@@ -2715,6 +2720,8 @@ void GDataFileSystem::LoadRootFeedFromCache( |
} |
void GDataFileSystem::OnProtoLoaded(LoadRootFeedParams* params) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
{ |
base::AutoLock lock(lock_); |
// If we have already received updates from the server, bail out. |
@@ -2744,7 +2751,7 @@ void GDataFileSystem::OnProtoLoaded(LoadRootFeedParams* params) { |
(params->load_error == base::PLATFORM_FILE_OK && !callback.is_null())) { |
// Continue file content search operation if the delegate hasn't terminated |
// this search branch already. |
- FindEntryByPathOnCallingThread(params->search_file_path, callback); |
+ FindEntryByPathSyncOnUIThread(params->search_file_path, callback); |
callback.Reset(); |
} |