blob: f1a6cbbf49ff772ebc4e9df1ca74a4df3d6b024f [file] [log] [blame]
craig.schlenter@chromium.orgb2d581e2011-04-15 01:56:01 +09001// Copyright (c) 2011 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.
4
5// Cross platform methods for FilePathWatcher. See the various platform
6// specific implementation files, too.
7
8#include "base/files/file_path_watcher.h"
9
10#include "base/logging.h"
11#include "base/message_loop.h"
12
13namespace base {
craig.schlenter@chromium.orgb2d581e2011-04-15 01:56:01 +090014
15FilePathWatcher::~FilePathWatcher() {
16 impl_->Cancel();
17}
18
jhawkins@chromium.orgfce1f412011-11-24 05:44:00 +090019// static
20void FilePathWatcher::CancelWatch(
21 const scoped_refptr<PlatformDelegate>& delegate) {
22 delegate->CancelOnMessageLoopThread();
23}
24
craig.schlenter@chromium.orgb2d581e2011-04-15 01:56:01 +090025FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) {
26}
27
28FilePathWatcher::PlatformDelegate::~PlatformDelegate() {
29 DCHECK(is_cancelled());
30}
31
kmadhusu@chromium.orgc9126e52012-12-05 09:36:39 +090032bool FilePathWatcher::Watch(const FilePath& path,
33 bool recursive,
34 const Callback& callback) {
35 DCHECK(path.IsAbsolute());
darin@chromium.org9498d472013-01-15 09:37:47 +090036 return impl_->Watch(path, recursive, callback);
joaodasilva@chromium.org5e575062012-06-04 23:21:27 +090037}
38
craig.schlenter@chromium.orgb2d581e2011-04-15 01:56:01 +090039} // namespace base