OLD | NEW |
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 "components/drive/file_write_watcher.h" | 5 #include "components/drive/file_write_watcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 FROM_HERE, | 108 FROM_HERE, |
109 base::Bind(&FileWriteWatcherImpl::StartWatchOnFileThread, | 109 base::Bind(&FileWriteWatcherImpl::StartWatchOnFileThread, |
110 base::Unretained(this), path, | 110 base::Unretained(this), path, |
111 google_apis::CreateRelayCallback(on_start_callback), | 111 google_apis::CreateRelayCallback(on_start_callback), |
112 google_apis::CreateRelayCallback(on_write_callback))); | 112 google_apis::CreateRelayCallback(on_write_callback))); |
113 } | 113 } |
114 | 114 |
115 FileWriteWatcher::FileWriteWatcherImpl::~FileWriteWatcherImpl() { | 115 FileWriteWatcher::FileWriteWatcherImpl::~FileWriteWatcherImpl() { |
116 DCHECK(file_task_runner_->BelongsToCurrentThread()); | 116 DCHECK(file_task_runner_->BelongsToCurrentThread()); |
117 | 117 |
118 STLDeleteContainerPairSecondPointers(watchers_.begin(), watchers_.end()); | 118 base::STLDeleteContainerPairSecondPointers(watchers_.begin(), |
| 119 watchers_.end()); |
119 } | 120 } |
120 | 121 |
121 void FileWriteWatcher::FileWriteWatcherImpl::DestroyOnFileThread() { | 122 void FileWriteWatcher::FileWriteWatcherImpl::DestroyOnFileThread() { |
122 DCHECK(file_task_runner_->BelongsToCurrentThread()); | 123 DCHECK(file_task_runner_->BelongsToCurrentThread()); |
123 | 124 |
124 delete this; | 125 delete this; |
125 } | 126 } |
126 | 127 |
127 void FileWriteWatcher::FileWriteWatcherImpl::StartWatchOnFileThread( | 128 void FileWriteWatcher::FileWriteWatcherImpl::StartWatchOnFileThread( |
128 const base::FilePath& path, | 129 const base::FilePath& path, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 DCHECK(thread_checker_.CalledOnValidThread()); | 203 DCHECK(thread_checker_.CalledOnValidThread()); |
203 watcher_impl_->StartWatch(file_path, on_start_callback, on_write_callback); | 204 watcher_impl_->StartWatch(file_path, on_start_callback, on_write_callback); |
204 } | 205 } |
205 | 206 |
206 void FileWriteWatcher::DisableDelayForTesting() { | 207 void FileWriteWatcher::DisableDelayForTesting() { |
207 watcher_impl_->set_delay(base::TimeDelta()); | 208 watcher_impl_->set_delay(base::TimeDelta()); |
208 } | 209 } |
209 | 210 |
210 } // namespace internal | 211 } // namespace internal |
211 } // namespace drive | 212 } // namespace drive |
OLD | NEW |