Index: chrome/browser/chromeos/drive/drive_app_registry.cc |
diff --git a/chrome/browser/chromeos/drive/drive_app_registry.cc b/chrome/browser/chromeos/drive/drive_app_registry.cc |
index 75b0418321cd7181f2e9f0acf31e70be4b545406..9e4bae6b3d56113f03bffc8a89c2e81ec8bcee82 100644 |
--- a/chrome/browser/chromeos/drive/drive_app_registry.cc |
+++ b/chrome/browser/chromeos/drive/drive_app_registry.cc |
@@ -95,6 +95,7 @@ DriveAppRegistry::DriveAppFileSelector::~DriveAppFileSelector() { |
DriveAppRegistry::DriveAppRegistry(JobScheduler* scheduler) |
: scheduler_(scheduler), |
+ is_updating_(false), |
weak_ptr_factory_(this) { |
} |
@@ -137,6 +138,11 @@ void DriveAppRegistry::GetAppsForFile( |
void DriveAppRegistry::Update() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ if (is_updating_) // There is already an update in progress. |
+ return; |
+ |
+ is_updating_ = true; |
+ |
scheduler_->GetAppList( |
base::Bind(&DriveAppRegistry::UpdateAfterGetAppList, |
weak_ptr_factory_.GetWeakPtr())); |
@@ -147,6 +153,9 @@ void DriveAppRegistry::UpdateAfterGetAppList( |
scoped_ptr<google_apis::AppList> app_list) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(is_updating_); |
+ is_updating_ = false; |
+ |
FileError error = GDataToFileError(gdata_error); |
if (error != FILE_ERROR_OK) { |
// Failed to fetch the data from the server. We can do nothing here. |