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

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_sync_service.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/sync_file_system/local/local_file_sync_service.h" 5 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "chrome/browser/extensions/extension_util.h" 10 #include "chrome/browser/extensions/extension_util.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 void LocalFileSyncService::MaybeInitializeFileSystemContext( 133 void LocalFileSyncService::MaybeInitializeFileSystemContext(
134 const GURL& app_origin, 134 const GURL& app_origin,
135 storage::FileSystemContext* file_system_context, 135 storage::FileSystemContext* file_system_context,
136 const SyncStatusCallback& callback) { 136 const SyncStatusCallback& callback) {
137 sync_context_->MaybeInitializeFileSystemContext( 137 sync_context_->MaybeInitializeFileSystemContext(
138 app_origin, file_system_context, 138 app_origin, file_system_context,
139 base::Bind(&LocalFileSyncService::DidInitializeFileSystemContext, 139 base::Bind(&LocalFileSyncService::DidInitializeFileSystemContext,
140 AsWeakPtr(), app_origin, 140 AsWeakPtr(), app_origin,
141 make_scoped_refptr(file_system_context), callback)); 141 base::RetainedRef(file_system_context), callback));
142 } 142 }
143 143
144 void LocalFileSyncService::AddChangeObserver(Observer* observer) { 144 void LocalFileSyncService::AddChangeObserver(Observer* observer) {
145 change_observers_.AddObserver(observer); 145 change_observers_.AddObserver(observer);
146 } 146 }
147 147
148 void LocalFileSyncService::RegisterURLForWaitingSync( 148 void LocalFileSyncService::RegisterURLForWaitingSync(
149 const FileSystemURL& url, 149 const FileSystemURL& url,
150 const base::Closure& on_syncable_callback) { 150 const base::Closure& on_syncable_callback) {
151 sync_context_->RegisterURLForWaitingSync(url, on_syncable_callback); 151 sync_context_->RegisterURLForWaitingSync(url, on_syncable_callback);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 SyncFileMetadata(), FileChangeList()); 244 SyncFileMetadata(), FileChangeList());
245 return; 245 return;
246 } 246 }
247 GURL site_url = 247 GURL site_url =
248 extensions::util::GetSiteForExtensionId(extension->id(), profile_); 248 extensions::util::GetSiteForExtensionId(extension->id(), profile_);
249 DCHECK(!site_url.is_empty()); 249 DCHECK(!site_url.is_empty());
250 scoped_refptr<storage::FileSystemContext> file_system_context = 250 scoped_refptr<storage::FileSystemContext> file_system_context =
251 content::BrowserContext::GetStoragePartitionForSite(profile_, site_url) 251 content::BrowserContext::GetStoragePartitionForSite(profile_, site_url)
252 ->GetFileSystemContext(); 252 ->GetFileSystemContext();
253 MaybeInitializeFileSystemContext( 253 MaybeInitializeFileSystemContext(
254 url.origin(), 254 url.origin(), file_system_context.get(),
255 file_system_context.get(),
256 base::Bind(&LocalFileSyncService::DidInitializeForRemoteSync, 255 base::Bind(&LocalFileSyncService::DidInitializeForRemoteSync,
257 AsWeakPtr(), 256 AsWeakPtr(), url, base::RetainedRef(file_system_context),
258 url,
259 file_system_context,
260 callback)); 257 callback));
261 return; 258 return;
262 } 259 }
263 260
264 DCHECK(ContainsKey(origin_to_contexts_, url.origin())); 261 DCHECK(ContainsKey(origin_to_contexts_, url.origin()));
265 sync_context_->PrepareForSync( 262 sync_context_->PrepareForSync(
266 origin_to_contexts_[url.origin()], url, 263 origin_to_contexts_[url.origin()], url,
267 LocalFileSyncContext::SYNC_EXCLUSIVE, 264 LocalFileSyncContext::SYNC_EXCLUSIVE,
268 base::Bind(&PrepareForProcessRemoteChangeCallbackAdapter, callback)); 265 base::Bind(&PrepareForProcessRemoteChangeCallbackAdapter, callback));
269 } 266 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 489
493 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( 490 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor(
494 const FileSystemURL& url) { 491 const FileSystemURL& url) {
495 if (!get_local_change_processor_.is_null()) 492 if (!get_local_change_processor_.is_null())
496 return get_local_change_processor_.Run(url.origin()); 493 return get_local_change_processor_.Run(url.origin());
497 DCHECK(local_change_processor_); 494 DCHECK(local_change_processor_);
498 return local_change_processor_; 495 return local_change_processor_;
499 } 496 }
500 497
501 } // namespace sync_file_system 498 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698