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

Side by Side Diff: chrome/browser/sync_file_system/sync_file_system_service.cc

Issue 610223002: [SyncFS] Use nullptr instead of NULL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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/sync_file_system/sync_file_system_service.h" 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 callback.Run(*files); 124 callback.Run(*files);
125 } 125 }
126 126
127 // We need this indirection because WeakPtr can only be bound to methods 127 // We need this indirection because WeakPtr can only be bound to methods
128 // without a return value. 128 // without a return value.
129 LocalChangeProcessor* GetLocalChangeProcessorAdapter( 129 LocalChangeProcessor* GetLocalChangeProcessorAdapter(
130 base::WeakPtr<SyncFileSystemService> service, 130 base::WeakPtr<SyncFileSystemService> service,
131 const GURL& origin) { 131 const GURL& origin) {
132 if (!service) 132 if (!service)
133 return NULL; 133 return nullptr;
134 return service->GetLocalChangeProcessor(origin); 134 return service->GetLocalChangeProcessor(origin);
135 } 135 }
136 136
137 } // namespace 137 } // namespace
138 138
139 //--------------------------------------------------------------------------- 139 //---------------------------------------------------------------------------
140 // SyncProcessRunner's. 140 // SyncProcessRunner's.
141 141
142 // SyncProcessRunner implementation for LocalSync. 142 // SyncProcessRunner implementation for LocalSync.
143 class LocalSyncRunner : public SyncProcessRunner, 143 class LocalSyncRunner : public SyncProcessRunner,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 remote_service_.reset(); 261 remote_service_.reset();
262 262
263 ProfileSyncServiceBase* profile_sync_service = 263 ProfileSyncServiceBase* profile_sync_service =
264 ProfileSyncServiceFactory::GetForProfile(profile_); 264 ProfileSyncServiceFactory::GetForProfile(profile_);
265 if (profile_sync_service) 265 if (profile_sync_service)
266 profile_sync_service->RemoveObserver(this); 266 profile_sync_service->RemoveObserver(this);
267 267
268 ExtensionRegistry::Get(profile_)->RemoveObserver(this); 268 ExtensionRegistry::Get(profile_)->RemoveObserver(this);
269 269
270 profile_ = NULL; 270 profile_ = nullptr;
271 } 271 }
272 272
273 SyncFileSystemService::~SyncFileSystemService() { 273 SyncFileSystemService::~SyncFileSystemService() {
274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
275 DCHECK(!profile_); 275 DCHECK(!profile_);
276 } 276 }
277 277
278 void SyncFileSystemService::InitializeForApp( 278 void SyncFileSystemService::InitializeForApp(
279 storage::FileSystemContext* file_system_context, 279 storage::FileSystemContext* file_system_context,
280 const GURL& app_origin, 280 const GURL& app_origin,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 base::Callback<void(base::DictionaryValue*, 562 base::Callback<void(base::DictionaryValue*,
563 SyncStatusCode, 563 SyncStatusCode,
564 SyncFileStatus)> completion_callback = 564 SyncFileStatus)> completion_callback =
565 base::Bind(&DidGetFileSyncStatusForDump, 565 base::Bind(&DidGetFileSyncStatusForDump,
566 base::Owned(dump_files.release()), 566 base::Owned(dump_files.release()),
567 base::Owned(new size_t(0)), 567 base::Owned(new size_t(0)),
568 callback); 568 callback);
569 569
570 // After all metadata loaded, sync status can be added to each entry. 570 // After all metadata loaded, sync status can be added to each entry.
571 for (size_t i = 0; i < files->GetSize(); ++i) { 571 for (size_t i = 0; i < files->GetSize(); ++i) {
572 base::DictionaryValue* file = NULL; 572 base::DictionaryValue* file = nullptr;
573 std::string path_string; 573 std::string path_string;
574 if (!files->GetDictionary(i, &file) || 574 if (!files->GetDictionary(i, &file) ||
575 !file->GetString("path", &path_string)) { 575 !file->GetString("path", &path_string)) {
576 NOTREACHED(); 576 NOTREACHED();
577 completion_callback.Run( 577 completion_callback.Run(
578 NULL, SYNC_FILE_ERROR_FAILED, SYNC_FILE_STATUS_UNKNOWN); 578 nullptr, SYNC_FILE_ERROR_FAILED, SYNC_FILE_STATUS_UNKNOWN);
579 continue; 579 continue;
580 } 580 }
581 581
582 base::FilePath file_path = base::FilePath::FromUTF8Unsafe(path_string); 582 base::FilePath file_path = base::FilePath::FromUTF8Unsafe(path_string);
583 FileSystemURL url = CreateSyncableFileSystemURL(origin, file_path); 583 FileSystemURL url = CreateSyncableFileSystemURL(origin, file_path);
584 GetFileSyncStatus(url, base::Bind(completion_callback, file)); 584 GetFileSyncStatus(url, base::Bind(completion_callback, file));
585 } 585 }
586 } 586 }
587 587
588 void SyncFileSystemService::DidDumpDatabase(const DumpFilesCallback& callback, 588 void SyncFileSystemService::DidDumpDatabase(const DumpFilesCallback& callback,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 iter != remote_sync_runners_.end(); ++iter) 745 iter != remote_sync_runners_.end(); ++iter)
746 ((*iter)->*method)(); 746 ((*iter)->*method)();
747 } 747 }
748 748
749 RemoteFileSyncService* SyncFileSystemService::GetRemoteService( 749 RemoteFileSyncService* SyncFileSystemService::GetRemoteService(
750 const GURL& origin) { 750 const GURL& origin) {
751 return remote_service_.get(); 751 return remote_service_.get();
752 } 752 }
753 753
754 } // namespace sync_file_system 754 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698