1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/files/file_path_watcher.h"
6 #include "base/files/file_path_watcher_kqueue.h"
9 #include "base/files/file_path_watcher_fsevents.h"
16 class FilePathWatcherImpl
: public FilePathWatcher::PlatformDelegate
{
18 bool Watch(const FilePath
& path
,
20 const FilePathWatcher::Callback
& callback
) override
{
21 // Use kqueue for non-recursive watches and FSEvents for recursive ones.
24 if (!FilePathWatcher::RecursiveWatchAvailable())
27 impl_
= new FilePathWatcherFSEvents();
30 impl_
= new FilePathWatcherKQueue();
33 return impl_
->Watch(path
, recursive
, callback
);
36 void Cancel() override
{
42 void CancelOnMessageLoopThread() override
{
49 ~FilePathWatcherImpl() override
{}
51 scoped_refptr
<PlatformDelegate
> impl_
;
56 FilePathWatcher::FilePathWatcher() {
57 impl_
= new FilePathWatcherImpl();