Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: base/files/file_path_watcher_win.cc

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // 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 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 "base/files/file_path_watcher.h" 5 #include "base/files/file_path_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop/message_loop_proxy.h" 13 #include "base/message_loop/message_loop_proxy.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/win/object_watcher.h" 15 #include "base/win/object_watcher.h"
16 16
17 namespace base { 17 namespace base {
18 18
19 namespace { 19 namespace {
20 20
21 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate, 21 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate,
22 public base::win::ObjectWatcher::Delegate, 22 public base::win::ObjectWatcher::Delegate,
23 public MessageLoop::DestructionObserver { 23 public MessageLoop::DestructionObserver {
24 public: 24 public:
25 FilePathWatcherImpl() 25 FilePathWatcherImpl()
26 : handle_(INVALID_HANDLE_VALUE), 26 : handle_(INVALID_HANDLE_VALUE),
27 recursive_watch_(false) {} 27 recursive_watch_(false) {}
28 28
29 // FilePathWatcher::PlatformDelegate overrides. 29 // FilePathWatcher::PlatformDelegate overrides.
30 virtual bool Watch(const FilePath& path, 30 bool Watch(const FilePath& path,
31 bool recursive, 31 bool recursive,
32 const FilePathWatcher::Callback& callback) OVERRIDE; 32 const FilePathWatcher::Callback& callback) override;
33 virtual void Cancel() OVERRIDE; 33 void Cancel() override;
34 34
35 // Deletion of the FilePathWatcher will call Cancel() to dispose of this 35 // Deletion of the FilePathWatcher will call Cancel() to dispose of this
36 // object in the right thread. This also observes destruction of the required 36 // object in the right thread. This also observes destruction of the required
37 // cleanup thread, in case it quits before Cancel() is called. 37 // cleanup thread, in case it quits before Cancel() is called.
38 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; 38 void WillDestroyCurrentMessageLoop() override;
39 39
40 // Callback from MessageLoopForIO. 40 // Callback from MessageLoopForIO.
41 virtual void OnObjectSignaled(HANDLE object); 41 virtual void OnObjectSignaled(HANDLE object);
42 42
43 private: 43 private:
44 virtual ~FilePathWatcherImpl() {} 44 virtual ~FilePathWatcherImpl() {}
45 45
46 // Setup a watch handle for directory |dir|. Set |recursive| to true to watch 46 // Setup a watch handle for directory |dir|. Set |recursive| to true to watch
47 // the directory sub trees. Returns true if no fatal error occurs. |handle| 47 // the directory sub trees. Returns true if no fatal error occurs. |handle|
48 // will receive the handle value if |dir| is watchable, otherwise 48 // will receive the handle value if |dir| is watchable, otherwise
49 // INVALID_HANDLE_VALUE. 49 // INVALID_HANDLE_VALUE.
50 static bool SetupWatchHandle(const FilePath& dir, 50 static bool SetupWatchHandle(const FilePath& dir,
51 bool recursive, 51 bool recursive,
52 HANDLE* handle) WARN_UNUSED_RESULT; 52 HANDLE* handle) WARN_UNUSED_RESULT;
53 53
54 // (Re-)Initialize the watch handle. 54 // (Re-)Initialize the watch handle.
55 bool UpdateWatch() WARN_UNUSED_RESULT; 55 bool UpdateWatch() WARN_UNUSED_RESULT;
56 56
57 // Destroy the watch handle. 57 // Destroy the watch handle.
58 void DestroyWatch(); 58 void DestroyWatch();
59 59
60 // Cleans up and stops observing the |message_loop_| thread. 60 // Cleans up and stops observing the |message_loop_| thread.
61 void CancelOnMessageLoopThread() OVERRIDE; 61 void CancelOnMessageLoopThread() override;
62 62
63 // Callback to notify upon changes. 63 // Callback to notify upon changes.
64 FilePathWatcher::Callback callback_; 64 FilePathWatcher::Callback callback_;
65 65
66 // Path we're supposed to watch (passed to callback). 66 // Path we're supposed to watch (passed to callback).
67 FilePath target_; 67 FilePath target_;
68 68
69 // Handle for FindFirstChangeNotification. 69 // Handle for FindFirstChangeNotification.
70 HANDLE handle_; 70 HANDLE handle_;
71 71
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 handle_ = INVALID_HANDLE_VALUE; 292 handle_ = INVALID_HANDLE_VALUE;
293 } 293 }
294 294
295 } // namespace 295 } // namespace
296 296
297 FilePathWatcher::FilePathWatcher() { 297 FilePathWatcher::FilePathWatcher() {
298 impl_ = new FilePathWatcherImpl(); 298 impl_ = new FilePathWatcherImpl();
299 } 299 }
300 300
301 } // namespace base 301 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698