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

Side by Side Diff: base/memory/ref_counted_delete_on_message_loop.h

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing includes. Created 5 years, 7 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
« no previous file with comments | « base/files/important_file_writer_unittest.cc ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_ 5 #ifndef BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_
6 #define BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_ 6 #define BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_
7 7
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 14 matching lines...) Expand all
25 // ... 25 // ...
26 // } 26 // }
27 // ... 27 // ...
28 // private: 28 // private:
29 // friend class RefCountedDeleteOnMessageLoop<Foo>; 29 // friend class RefCountedDeleteOnMessageLoop<Foo>;
30 // friend class DeleteHelper<Foo>; 30 // friend class DeleteHelper<Foo>;
31 // 31 //
32 // ~Foo(); 32 // ~Foo();
33 // }; 33 // };
34 34
35 // TODO(skyostil): Rename this to RefCountedDeleteOnTaskRunner.
35 template <class T> 36 template <class T>
36 class RefCountedDeleteOnMessageLoop : public subtle::RefCountedThreadSafeBase { 37 class RefCountedDeleteOnMessageLoop : public subtle::RefCountedThreadSafeBase {
37 public: 38 public:
38 // This constructor will accept a MessageL00pProxy object, but new code should 39 // This constructor will accept a MessageL00pProxy object, but new code should
39 // prefer a SingleThreadTaskRunner. A SingleThreadTaskRunner for the 40 // prefer a SingleThreadTaskRunner. A SingleThreadTaskRunner for the
40 // MessageLoop on the current thread can be acquired by calling 41 // MessageLoop on the current thread can be acquired by calling
41 // MessageLoop::current()->task_runner(). 42 // MessageLoop::current()->task_runner().
42 RefCountedDeleteOnMessageLoop( 43 RefCountedDeleteOnMessageLoop(
43 const scoped_refptr<SingleThreadTaskRunner>& task_runner) 44 const scoped_refptr<SingleThreadTaskRunner>& task_runner)
44 : task_runner_(task_runner) { 45 : task_runner_(task_runner) {
45 DCHECK(task_runner_.get()); 46 DCHECK(task_runner_);
46 } 47 }
47 48
48 void AddRef() const { 49 void AddRef() const {
49 subtle::RefCountedThreadSafeBase::AddRef(); 50 subtle::RefCountedThreadSafeBase::AddRef();
50 } 51 }
51 52
52 void Release() const { 53 void Release() const {
53 if (subtle::RefCountedThreadSafeBase::Release()) 54 if (subtle::RefCountedThreadSafeBase::Release())
54 DestructOnMessageLoop(); 55 DestructOnMessageLoop();
55 } 56 }
(...skipping 12 matching lines...) Expand all
68 69
69 scoped_refptr<SingleThreadTaskRunner> task_runner_; 70 scoped_refptr<SingleThreadTaskRunner> task_runner_;
70 71
71 private: 72 private:
72 DISALLOW_COPY_AND_ASSIGN(RefCountedDeleteOnMessageLoop); 73 DISALLOW_COPY_AND_ASSIGN(RefCountedDeleteOnMessageLoop);
73 }; 74 };
74 75
75 } // namespace base 76 } // namespace base
76 77
77 #endif // BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_ 78 #endif // BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/files/important_file_writer_unittest.cc ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698