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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/folder_creator.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 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/drive_backend/folder_creator.h" 5 #include "chrome/browser/sync_file_system/drive_backend/folder_creator.h"
6 6
7 #include "chrome/browser/drive/drive_api_util.h" 7 #include "chrome/browser/drive/drive_api_util.h"
8 #include "chrome/browser/drive/drive_service_interface.h" 8 #include "chrome/browser/drive/drive_service_interface.h"
9 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" 9 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
10 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" 10 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 if (!file_list->next_link().is_empty()) { 90 if (!file_list->next_link().is_empty()) {
91 drive_service_->GetRemainingFileList( 91 drive_service_->GetRemainingFileList(
92 file_list->next_link(), 92 file_list->next_link(),
93 base::Bind(&FolderCreator::DidListFolders, 93 base::Bind(&FolderCreator::DidListFolders,
94 weak_ptr_factory_.GetWeakPtr(), callback, 94 weak_ptr_factory_.GetWeakPtr(), callback,
95 base::Passed(&candidates))); 95 base::Passed(&candidates)));
96 return; 96 return;
97 } 97 }
98 98
99 const google_apis::FileResource* oldest = NULL; 99 const google_apis::FileResource* oldest = nullptr;
100 for (size_t i = 0; i < candidates.size(); ++i) { 100 for (size_t i = 0; i < candidates.size(); ++i) {
101 const google_apis::FileResource& entry = *candidates[i]; 101 const google_apis::FileResource& entry = *candidates[i];
102 if (!entry.IsDirectory() || entry.labels().is_trashed()) 102 if (!entry.IsDirectory() || entry.labels().is_trashed())
103 continue; 103 continue;
104 104
105 if (!oldest || oldest->created_date() > entry.created_date()) 105 if (!oldest || oldest->created_date() > entry.created_date())
106 oldest = &entry; 106 oldest = &entry;
107 } 107 }
108 108
109 if (!oldest) { 109 if (!oldest) {
110 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND); 110 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND);
111 return; 111 return;
112 } 112 }
113 113
114 std::string file_id = oldest->file_id(); 114 std::string file_id = oldest->file_id();
115 115
116 status = metadata_database_->UpdateByFileResourceList(candidates.Pass()); 116 status = metadata_database_->UpdateByFileResourceList(candidates.Pass());
117 if (status != SYNC_STATUS_OK) { 117 if (status != SYNC_STATUS_OK) {
118 callback.Run(std::string(), status); 118 callback.Run(std::string(), status);
119 return; 119 return;
120 } 120 }
121 121
122 DCHECK(!file_id.empty()); 122 DCHECK(!file_id.empty());
123 if (!metadata_database_->FindFileByFileID(file_id, NULL)) { 123 if (!metadata_database_->FindFileByFileID(file_id, nullptr)) {
124 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND); 124 callback.Run(std::string(), SYNC_FILE_ERROR_NOT_FOUND);
125 return; 125 return;
126 } 126 }
127 127
128 callback.Run(file_id, status); 128 callback.Run(file_id, status);
129 } 129 }
130 130
131 } // namespace drive_backend 131 } // namespace drive_backend
132 } // namespace sync_file_system 132 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698