| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/syncable/directory_manager.h" | 5 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 const PathString DirectoryManager::GetSyncDataDatabasePath() const { | 32 const PathString DirectoryManager::GetSyncDataDatabasePath() const { |
| 33 PathString path(root_path_); | 33 PathString path(root_path_); |
| 34 path.append(kSyncDataDatabaseFilename); | 34 path.append(kSyncDataDatabaseFilename); |
| 35 return path; | 35 return path; |
| 36 } | 36 } |
| 37 | 37 |
| 38 DirectoryManager::DirectoryManager(const PathString& path) | 38 DirectoryManager::DirectoryManager(const PathString& path) |
| 39 : root_path_(AppendSlash(path)), | 39 : root_path_(AppendSlash(path)), |
| 40 channel_(new Channel(DirectoryManagerShutdownEvent())), | 40 managed_directory_(NULL), |
| 41 managed_directory_(NULL) { | 41 channel_(new Channel(DirectoryManagerShutdownEvent())) { |
| 42 CHECK(0 == pthread_mutex_init(&mutex_, NULL)); | 42 CHECK(0 == pthread_mutex_init(&mutex_, NULL)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 DirectoryManager::~DirectoryManager() { | 45 DirectoryManager::~DirectoryManager() { |
| 46 DCHECK_EQ(managed_directory_, static_cast<Directory*>(NULL)) | 46 DCHECK_EQ(managed_directory_, static_cast<Directory*>(NULL)) |
| 47 << "Dir " << managed_directory_->name() << " not closed!"; | 47 << "Dir " << managed_directory_->name() << " not closed!"; |
| 48 pthread_mutex_lock(&mutex_); | 48 pthread_mutex_lock(&mutex_); |
| 49 delete channel_; | 49 delete channel_; |
| 50 pthread_mutex_unlock(&mutex_); | 50 pthread_mutex_unlock(&mutex_); |
| 51 CHECK(0 == pthread_mutex_destroy(&mutex_)); | 51 CHECK(0 == pthread_mutex_destroy(&mutex_)); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 return dir_; | 160 return dir_; |
| 161 } | 161 } |
| 162 | 162 |
| 163 ScopedDirLookup::operator Directory* () const { | 163 ScopedDirLookup::operator Directory* () const { |
| 164 CHECK(good_checked_); | 164 CHECK(good_checked_); |
| 165 DCHECK(good_); | 165 DCHECK(good_); |
| 166 return dir_; | 166 return dir_; |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace syncable | 169 } // namespace syncable |
| OLD | NEW |