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

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

Issue 1113953002: Revert of base: Remove use of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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.
36 template <class T> 35 template <class T>
37 class RefCountedDeleteOnMessageLoop : public subtle::RefCountedThreadSafeBase { 36 class RefCountedDeleteOnMessageLoop : public subtle::RefCountedThreadSafeBase {
38 public: 37 public:
39 // This constructor will accept a MessageL00pProxy object, but new code should 38 // This constructor will accept a MessageL00pProxy object, but new code should
40 // prefer a SingleThreadTaskRunner. A SingleThreadTaskRunner for the 39 // prefer a SingleThreadTaskRunner. A SingleThreadTaskRunner for the
41 // MessageLoop on the current thread can be acquired by calling 40 // MessageLoop on the current thread can be acquired by calling
42 // MessageLoop::current()->task_runner(). 41 // MessageLoop::current()->task_runner().
43 RefCountedDeleteOnMessageLoop( 42 RefCountedDeleteOnMessageLoop(
44 const scoped_refptr<SingleThreadTaskRunner>& task_runner) 43 const scoped_refptr<SingleThreadTaskRunner>& task_runner)
45 : task_runner_(task_runner) { 44 : task_runner_(task_runner) {
46 DCHECK(task_runner_); 45 DCHECK(task_runner_.get());
47 } 46 }
48 47
49 void AddRef() const { 48 void AddRef() const {
50 subtle::RefCountedThreadSafeBase::AddRef(); 49 subtle::RefCountedThreadSafeBase::AddRef();
51 } 50 }
52 51
53 void Release() const { 52 void Release() const {
54 if (subtle::RefCountedThreadSafeBase::Release()) 53 if (subtle::RefCountedThreadSafeBase::Release())
55 DestructOnMessageLoop(); 54 DestructOnMessageLoop();
56 } 55 }
(...skipping 12 matching lines...) Expand all
69 68
70 scoped_refptr<SingleThreadTaskRunner> task_runner_; 69 scoped_refptr<SingleThreadTaskRunner> task_runner_;
71 70
72 private: 71 private:
73 DISALLOW_COPY_AND_ASSIGN(RefCountedDeleteOnMessageLoop); 72 DISALLOW_COPY_AND_ASSIGN(RefCountedDeleteOnMessageLoop);
74 }; 73 };
75 74
76 } // namespace base 75 } // namespace base
77 76
78 #endif // BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_ 77 #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