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

Side by Side Diff: content/browser/background_sync/background_sync_manager.cc

Issue 1353613002: [BackgroundSync] Clean up some style nits and unnecessary checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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
« no previous file with comments | « no previous file | content/browser/background_sync/background_sync_service_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/background_sync/background_sync_manager.h" 5 #include "content/browser/background_sync/background_sync_manager.h"
6 6
7 #include "base/barrier_closure.h" 7 #include "base/barrier_closure.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 if (status_code != SERVICE_WORKER_OK) { 1027 if (status_code != SERVICE_WORKER_OK) {
1028 // TODO(jkarlin) Fire the sync event on the next page load controlled by 1028 // TODO(jkarlin) Fire the sync event on the next page load controlled by
1029 // this registration. (crbug.com/479665) 1029 // this registration. (crbug.com/479665)
1030 registration->set_sync_state(BACKGROUND_SYNC_STATE_FAILED); 1030 registration->set_sync_state(BACKGROUND_SYNC_STATE_FAILED);
1031 } else { 1031 } else {
1032 RegistrationKey key(*registration); 1032 RegistrationKey key(*registration);
1033 // Remove the registration if it's still active. 1033 // Remove the registration if it's still active.
1034 RefCountedRegistration* active_registration = 1034 RefCountedRegistration* active_registration =
1035 LookupActiveRegistration(service_worker_id, key); 1035 LookupActiveRegistration(service_worker_id, key);
1036 if (active_registration && 1036 if (active_registration &&
1037 active_registration->value()->id() == registration->id()) 1037 active_registration->value()->id() == registration->id()) {
1038 RemoveActiveRegistration(service_worker_id, key); 1038 RemoveActiveRegistration(service_worker_id, key);
1039 }
1039 } 1040 }
1040 } else { 1041 } else {
1041 // TODO(jkarlin): Add support for running periodic syncs. (crbug.com/479674) 1042 // TODO(jkarlin): Add support for running periodic syncs. (crbug.com/479674)
1042 NOTREACHED(); 1043 NOTREACHED();
1043 } 1044 }
1044 1045
1045 StoreRegistrations( 1046 StoreRegistrations(
1046 service_worker_id, 1047 service_worker_id,
1047 base::Bind(&BackgroundSyncManager::EventCompleteDidStore, 1048 base::Bind(&BackgroundSyncManager::EventCompleteDidStore,
1048 weak_ptr_factory_.GetWeakPtr(), service_worker_id, callback)); 1049 weak_ptr_factory_.GetWeakPtr(), service_worker_id, callback));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { 1185 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) {
1185 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1186 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1186 1187
1187 return base::Bind( 1188 return base::Bind(
1188 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, 1189 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback,
1189 BackgroundSyncStatus>, 1190 BackgroundSyncStatus>,
1190 weak_ptr_factory_.GetWeakPtr(), callback); 1191 weak_ptr_factory_.GetWeakPtr(), callback);
1191 } 1192 }
1192 1193
1193 } // namespace content 1194 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/background_sync/background_sync_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698