blob: 3802ee3a3e93d8eff8be7cce01b72d9f88766036 [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 {
14namespace files {
15
16FilePathWatcher::~FilePathWatcher() {
17 impl_->Cancel();
18}
19
jhawkins@chromium.orgfce1f412011-11-24 05:44:00 +090020// static
21void FilePathWatcher::CancelWatch(
22 const scoped_refptr<PlatformDelegate>& delegate) {
23 delegate->CancelOnMessageLoopThread();
24}
25
craig.schlenter@chromium.orgb2d581e2011-04-15 01:56:01 +090026FilePathWatcher::PlatformDelegate::PlatformDelegate(): cancelled_(false) {
27}
28
29FilePathWatcher::PlatformDelegate::~PlatformDelegate() {
30 DCHECK(is_cancelled());
31}
32
kmadhusu@chromium.orgc9126e52012-12-05 09:36:39 +090033bool FilePathWatcher::Watch(const FilePath& path,
34 bool recursive,
35 const Callback& callback) {
36 DCHECK(path.IsAbsolute());
darin@chromium.org9498d472013-01-15 09:37:47 +090037 return impl_->Watch(path, recursive, callback);
joaodasilva@chromium.org5e575062012-06-04 23:21:27 +090038}
39
craig.schlenter@chromium.orgb2d581e2011-04-15 01:56:01 +090040} // namespace files
41} // namespace base