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

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

Issue 10065037: RefCounted types should not have public destructors, base/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
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 <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/event.h> 8 #include <sys/event.h>
9 #include <sys/param.h> 9 #include <sys/param.h>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // The kqueue implementation will handle all of the items in the list above 47 // The kqueue implementation will handle all of the items in the list above
48 // except for detecting modifications to files in a watched directory. It will 48 // except for detecting modifications to files in a watched directory. It will
49 // detect the creation and deletion of files, just not the modification of 49 // detect the creation and deletion of files, just not the modification of
50 // files. It does however detect the attribute changes that the FSEvents impl 50 // files. It does however detect the attribute changes that the FSEvents impl
51 // would miss. 51 // would miss.
52 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate, 52 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate,
53 public MessageLoopForIO::Watcher, 53 public MessageLoopForIO::Watcher,
54 public MessageLoop::DestructionObserver { 54 public MessageLoop::DestructionObserver {
55 public: 55 public:
56 FilePathWatcherImpl() : kqueue_(-1) {} 56 FilePathWatcherImpl() : kqueue_(-1) {}
57 virtual ~FilePathWatcherImpl() {}
58 57
59 // MessageLoopForIO::Watcher overrides. 58 // MessageLoopForIO::Watcher overrides.
60 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 59 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
61 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; 60 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
62 61
63 // MessageLoop::DestructionObserver overrides. 62 // MessageLoop::DestructionObserver overrides.
64 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; 63 virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
65 64
66 // FilePathWatcher::PlatformDelegate overrides. 65 // FilePathWatcher::PlatformDelegate overrides.
67 virtual bool Watch(const FilePath& path, 66 virtual bool Watch(const FilePath& path,
68 FilePathWatcher::Delegate* delegate) OVERRIDE; 67 FilePathWatcher::Delegate* delegate) OVERRIDE;
69 virtual void Cancel() OVERRIDE; 68 virtual void Cancel() OVERRIDE;
70 69
71 private: 70 private:
71 virtual ~FilePathWatcherImpl() {}
72
72 class EventData { 73 class EventData {
73 public: 74 public:
74 EventData(const FilePath& path, const FilePath::StringType& subdir) 75 EventData(const FilePath& path, const FilePath::StringType& subdir)
75 : path_(path), subdir_(subdir) { } 76 : path_(path), subdir_(subdir) { }
76 FilePath path_; // Full path to this item. 77 FilePath path_; // Full path to this item.
77 FilePath::StringType subdir_; // Path to any sub item. 78 FilePath::StringType subdir_; // Path to any sub item.
78 }; 79 };
79 typedef std::vector<struct kevent> EventVector; 80 typedef std::vector<struct kevent> EventVector;
80 81
81 // Can only be called on |io_message_loop_|'s thread. 82 // Can only be called on |io_message_loop_|'s thread.
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 494 }
494 495
495 } // namespace 496 } // namespace
496 497
497 FilePathWatcher::FilePathWatcher() { 498 FilePathWatcher::FilePathWatcher() {
498 impl_ = new FilePathWatcherImpl(); 499 impl_ = new FilePathWatcherImpl();
499 } 500 }
500 501
501 } // namespace files 502 } // namespace files
502 } // namespace base 503 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698