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

Side by Side Diff: chrome/browser/file_path_watcher_browsertest.cc

Issue 4188008: Use make_scoped_refptr for NewRunnableMethod if the raw ptr type is derivd from RefCountedThreadSafe (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: address comment Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/file_path_watcher.h" 5 #include "chrome/browser/file_path_watcher.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 26 matching lines...) Expand all
37 : public base::RefCountedThreadSafe<NotificationCollector> { 37 : public base::RefCountedThreadSafe<NotificationCollector> {
38 public: 38 public:
39 NotificationCollector() 39 NotificationCollector()
40 : loop_(base::MessageLoopProxy::CreateForCurrentThread()) {} 40 : loop_(base::MessageLoopProxy::CreateForCurrentThread()) {}
41 41
42 // Called from the file thread by the delegates. 42 // Called from the file thread by the delegates.
43 void OnChange(TestDelegate* delegate) { 43 void OnChange(TestDelegate* delegate) {
44 loop_->PostTask(FROM_HERE, 44 loop_->PostTask(FROM_HERE,
45 NewRunnableMethod(this, 45 NewRunnableMethod(this,
46 &NotificationCollector::RecordChange, 46 &NotificationCollector::RecordChange,
47 delegate)); 47 make_scoped_refptr(delegate)));
48 } 48 }
49 49
50 void Register(TestDelegate* delegate) { 50 void Register(TestDelegate* delegate) {
51 delegates_.insert(delegate); 51 delegates_.insert(delegate);
52 } 52 }
53 53
54 void Reset() { 54 void Reset() {
55 signaled_.clear(); 55 signaled_.clear();
56 } 56 }
57 57
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 SetupWatch(dest_file, &file_watcher, file_delegate.get()); 446 SetupWatch(dest_file, &file_watcher, file_delegate.get());
447 scoped_refptr<TestDelegate> subdir_delegate(new TestDelegate(collector())); 447 scoped_refptr<TestDelegate> subdir_delegate(new TestDelegate(collector()));
448 SetupWatch(dest_subdir, &subdir_watcher, subdir_delegate.get()); 448 SetupWatch(dest_subdir, &subdir_watcher, subdir_delegate.get());
449 449
450 // Move the directory into place, s.t. the watched file appears. 450 // Move the directory into place, s.t. the watched file appears.
451 ASSERT_TRUE(file_util::Move(source_dir, dest_dir)); 451 ASSERT_TRUE(file_util::Move(source_dir, dest_dir));
452 WaitForEvents(); 452 WaitForEvents();
453 } 453 }
454 454
455 } // namespace 455 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_file_manager.cc ('k') | chrome/browser/importer/importer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698