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

Side by Side Diff: base/directory_watcher_win.cc

Issue 360042: First patch in making destructors of refcounted objects private. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/directory_watcher.h" 5 #include "base/directory_watcher.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/object_watcher.h" 9 #include "base/object_watcher.h"
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 11
12 namespace { 12 namespace {
13 13
14 class DirectoryWatcherImpl : public DirectoryWatcher::PlatformDelegate, 14 class DirectoryWatcherImpl : public DirectoryWatcher::PlatformDelegate,
15 public base::ObjectWatcher::Delegate { 15 public base::ObjectWatcher::Delegate {
16 public: 16 public:
17 DirectoryWatcherImpl() : delegate_(NULL), handle_(INVALID_HANDLE_VALUE) {} 17 DirectoryWatcherImpl() : delegate_(NULL), handle_(INVALID_HANDLE_VALUE) {}
18 virtual ~DirectoryWatcherImpl();
19 18
20 virtual bool Watch(const FilePath& path, DirectoryWatcher::Delegate* delegate, 19 virtual bool Watch(const FilePath& path, DirectoryWatcher::Delegate* delegate,
21 MessageLoop* backend_loop, bool recursive); 20 MessageLoop* backend_loop, bool recursive);
22 21
23 // Callback from MessageLoopForIO. 22 // Callback from MessageLoopForIO.
24 virtual void OnObjectSignaled(HANDLE object); 23 virtual void OnObjectSignaled(HANDLE object);
25 24
26 private: 25 private:
26 virtual ~DirectoryWatcherImpl();
27
27 // Delegate to notify upon changes. 28 // Delegate to notify upon changes.
28 DirectoryWatcher::Delegate* delegate_; 29 DirectoryWatcher::Delegate* delegate_;
29 // Path we're watching (passed to delegate). 30 // Path we're watching (passed to delegate).
30 FilePath path_; 31 FilePath path_;
31 // Handle for FindFirstChangeNotification. 32 // Handle for FindFirstChangeNotification.
32 HANDLE handle_; 33 HANDLE handle_;
33 // ObjectWatcher to watch handle_ for events. 34 // ObjectWatcher to watch handle_ for events.
34 base::ObjectWatcher watcher_; 35 base::ObjectWatcher watcher_;
35 36
36 DISALLOW_COPY_AND_ASSIGN(DirectoryWatcherImpl); 37 DISALLOW_COPY_AND_ASSIGN(DirectoryWatcherImpl);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 BOOL ok = FindNextChangeNotification(object); 75 BOOL ok = FindNextChangeNotification(object);
75 DCHECK(ok); 76 DCHECK(ok);
76 watcher_.StartWatching(object, this); 77 watcher_.StartWatching(object, this);
77 } 78 }
78 79
79 } // namespace 80 } // namespace
80 81
81 DirectoryWatcher::DirectoryWatcher() { 82 DirectoryWatcher::DirectoryWatcher() {
82 impl_ = new DirectoryWatcherImpl(); 83 impl_ = new DirectoryWatcherImpl();
83 } 84 }
OLDNEW
« no previous file with comments | « base/directory_watcher.h ('k') | base/field_trial.h » ('j') | base/field_trial.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698