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

Side by Side Diff: content/common/file_path_watcher/file_path_watcher.h

Issue 6697020: Fixed shutdown concurrency issues in FilePathWatcher. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Tested and updated after changes from 6670081 Created 9 years, 9 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 // This module provides a way to monitor a file or directory for changes. 5 // This module provides a way to monitor a file or directory for changes.
6 6
7 #ifndef CONTENT_COMMON_FILE_PATH_WATCHER_FILE_PATH_WATCHER_H_ 7 #ifndef CONTENT_COMMON_FILE_PATH_WATCHER_FILE_PATH_WATCHER_H_
8 #define CONTENT_COMMON_FILE_PATH_WATCHER_FILE_PATH_WATCHER_H_ 8 #define CONTENT_COMMON_FILE_PATH_WATCHER_FILE_PATH_WATCHER_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 22 matching lines...) Expand all
33 }; 33 };
34 34
35 FilePathWatcher(); 35 FilePathWatcher();
36 ~FilePathWatcher(); 36 ~FilePathWatcher();
37 37
38 // Register interest in any changes on |path|. OnPathChanged will be called 38 // Register interest in any changes on |path|. OnPathChanged will be called
39 // back for each change. Returns true on success. |loop| is only used 39 // back for each change. Returns true on success. |loop| is only used
40 // by the Mac implementation right now, and must be backed by a CFRunLoop 40 // by the Mac implementation right now, and must be backed by a CFRunLoop
41 // based MessagePump. This is usually going to be a MessageLoop of type 41 // based MessagePump. This is usually going to be a MessageLoop of type
42 // TYPE_UI. 42 // TYPE_UI.
43 // OnFilePathChanged() will be called on the same thread as Watch() is called,
44 // which should have a MessageLoop of TYPE_IO.
43 bool Watch(const FilePath& path, 45 bool Watch(const FilePath& path,
44 Delegate* delegate, 46 Delegate* delegate,
45 base::MessageLoopProxy* loop) WARN_UNUSED_RESULT; 47 base::MessageLoopProxy* loop) WARN_UNUSED_RESULT;
46 48
47 class PlatformDelegate; 49 class PlatformDelegate;
48 50
49 // Traits for PlatformDelegate, which must delete itself on the IO message 51 // Traits for PlatformDelegate, which must delete itself on the IO message
50 // loop that Watch was called from. 52 // loop that Watch was called from.
51 struct DeletePlatformDelegate { 53 struct DeletePlatformDelegate {
52 static void Destruct(const PlatformDelegate* delegate); 54 static void Destruct(const PlatformDelegate* delegate);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 scoped_refptr<base::MessageLoopProxy> message_loop_; 92 scoped_refptr<base::MessageLoopProxy> message_loop_;
91 }; 93 };
92 94
93 private: 95 private:
94 scoped_refptr<PlatformDelegate> impl_; 96 scoped_refptr<PlatformDelegate> impl_;
95 97
96 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher); 98 DISALLOW_COPY_AND_ASSIGN(FilePathWatcher);
97 }; 99 };
98 100
99 #endif // CONTENT_COMMON_FILE_PATH_WATCHER_FILE_PATH_WATCHER_H_ 101 #endif // CONTENT_COMMON_FILE_PATH_WATCHER_FILE_PATH_WATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698