OLD | NEW |
---|---|
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/chromeos/gdata/gdata_directory_service.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_directory_service.h" |
6 | 6 |
7 #include <leveldb/db.h> | 7 #include <leveldb/db.h> |
8 | 8 |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 | 196 |
197 GDataDirectoryService::~GDataDirectoryService() { | 197 GDataDirectoryService::~GDataDirectoryService() { |
198 ClearRoot(); | 198 ClearRoot(); |
199 | 199 |
200 // Ensure db is closed on the blocking pool. | 200 // Ensure db is closed on the blocking pool. |
201 if (blocking_task_runner_ && directory_service_db_.get()) | 201 if (blocking_task_runner_ && directory_service_db_.get()) |
202 blocking_task_runner_->DeleteSoon(FROM_HERE, | 202 blocking_task_runner_->DeleteSoon(FROM_HERE, |
203 directory_service_db_.release()); | 203 directory_service_db_.release()); |
204 } | 204 } |
205 | 205 |
206 GDataEntry* GDataDirectoryService::FromDocumentEntry(DocumentEntry* doc) { | 206 GDataEntry* GDataDirectoryService::FromDocumentEntry(const DocumentEntry& doc) { |
207 DCHECK(doc); | 207 DCHECK(&doc); |
hashimoto
2012/08/16 06:22:54
No need to null-check references.
kochi
2012/08/16 06:41:34
Done.
| |
208 GDataEntry* entry = NULL; | 208 GDataEntry* entry = NULL; |
209 if (doc->is_folder()) | 209 if (doc.is_folder()) |
210 entry = CreateGDataDirectory(); | 210 entry = CreateGDataDirectory(); |
211 else if (doc->is_hosted_document() || doc->is_file()) | 211 else if (doc.is_hosted_document() || doc.is_file()) |
212 entry = CreateGDataFile(); | 212 entry = CreateGDataFile(); |
213 | 213 |
214 if (entry) | 214 if (entry) |
215 entry->InitFromDocumentEntry(doc); | 215 entry->InitFromDocumentEntry(doc); |
216 return entry; | 216 return entry; |
217 } | 217 } |
218 | 218 |
219 GDataFile* GDataDirectoryService::CreateGDataFile() { | 219 GDataFile* GDataDirectoryService::CreateGDataFile() { |
220 return new GDataFile(this); | 220 return new GDataFile(this); |
221 } | 221 } |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 DCHECK(result.get()); | 754 DCHECK(result.get()); |
755 | 755 |
756 result->second.path = second_path; | 756 result->second.path = second_path; |
757 result->second.error = error; | 757 result->second.error = error; |
758 result->second.proto = entry_proto.Pass(); | 758 result->second.proto = entry_proto.Pass(); |
759 | 759 |
760 callback.Run(result.Pass()); | 760 callback.Run(result.Pass()); |
761 } | 761 } |
762 | 762 |
763 } // namespace gdata | 763 } // namespace gdata |
OLD | NEW |