Chromium Code Reviews| Index: base/files/file_path_watcher_mac.cc |
| diff --git a/base/files/file_path_watcher_mac.cc b/base/files/file_path_watcher_mac.cc |
| index d59ca2156beb79705fa0f76c6817702d70f4dd62..a52a5690025d3053b9b12e6cd29f77f8d055fffa 100644 |
| --- a/base/files/file_path_watcher_mac.cc |
| +++ b/base/files/file_path_watcher_mac.cc |
| @@ -2,8 +2,11 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include <memory> |
| + |
| #include "base/files/file_path_watcher.h" |
| #include "base/files/file_path_watcher_kqueue.h" |
| +#include "base/memory/ptr_util.h" |
| #include "build/build_config.h" |
| #if !defined(OS_IOS) |
| @@ -16,6 +19,8 @@ namespace { |
| class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { |
| public: |
| + ~FilePathWatcherImpl() override = default; |
| + |
| bool Watch(const FilePath& path, |
| bool recursive, |
| const FilePathWatcher::Callback& callback) override { |
| @@ -25,10 +30,10 @@ class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { |
| if (!FilePathWatcher::RecursiveWatchAvailable()) |
| return false; |
| #if !defined(OS_IOS) |
| - impl_ = new FilePathWatcherFSEvents(); |
| + impl_ = MakeUnique<FilePathWatcherFSEvents>(); |
| #endif // OS_IOS |
| } else { |
| - impl_ = new FilePathWatcherKQueue(); |
| + impl_ = MakeUnique<FilePathWatcherKQueue>(); |
| } |
| DCHECK(impl_.get()); |
| return impl_->Watch(path, recursive, callback); |
| @@ -40,17 +45,15 @@ class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { |
| set_cancelled(); |
| } |
| - protected: |
| - ~FilePathWatcherImpl() override {} |
| - |
| - scoped_refptr<PlatformDelegate> impl_; |
| + private: |
| + std::unique_ptr<PlatformDelegate> impl_; |
|
gab
2017/01/09 17:21:39
DISALLOW_...
fdoray
2017/01/09 21:30:21
Done.
|
| }; |
| } // namespace |
| FilePathWatcher::FilePathWatcher() { |
| sequence_checker_.DetachFromSequence(); |
| - impl_ = new FilePathWatcherImpl(); |
| + impl_ = MakeUnique<FilePathWatcherImpl>(); |
| } |
| } // namespace base |