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

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

Issue 2375663002: Replace MessageLoop::current()->task_runner() with ThreadTaskRunnerHandle::Get(). (Closed)
Patch Set: rebase Created 4 years, 2 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 | « ash/shelf/shelf_view_unittest.cc ('k') | base/message_loop/message_loop_test.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/macros.h" 10 #include "base/macros.h"
(...skipping 15 matching lines...) Expand all
26 // friend class RefCountedDeleteOnMessageLoop<Foo>; 26 // friend class RefCountedDeleteOnMessageLoop<Foo>;
27 // friend class DeleteHelper<Foo>; 27 // friend class DeleteHelper<Foo>;
28 // 28 //
29 // ~Foo(); 29 // ~Foo();
30 // }; 30 // };
31 31
32 // TODO(skyostil): Rename this to RefCountedDeleteOnTaskRunner. 32 // TODO(skyostil): Rename this to RefCountedDeleteOnTaskRunner.
33 template <class T> 33 template <class T>
34 class RefCountedDeleteOnMessageLoop : public subtle::RefCountedThreadSafeBase { 34 class RefCountedDeleteOnMessageLoop : public subtle::RefCountedThreadSafeBase {
35 public: 35 public:
36 // This constructor will accept a MessageL00pProxy object, but new code should 36 // A SingleThreadTaskRunner for the current thread can be acquired by calling
37 // prefer a SingleThreadTaskRunner. A SingleThreadTaskRunner for the 37 // ThreadTaskRunnerHandle::Get().
38 // MessageLoop on the current thread can be acquired by calling
39 // MessageLoop::current()->task_runner().
40 RefCountedDeleteOnMessageLoop( 38 RefCountedDeleteOnMessageLoop(
41 scoped_refptr<SingleThreadTaskRunner> task_runner) 39 scoped_refptr<SingleThreadTaskRunner> task_runner)
42 : task_runner_(std::move(task_runner)) { 40 : task_runner_(std::move(task_runner)) {
43 DCHECK(task_runner_); 41 DCHECK(task_runner_);
44 } 42 }
45 43
46 void AddRef() const { 44 void AddRef() const {
47 subtle::RefCountedThreadSafeBase::AddRef(); 45 subtle::RefCountedThreadSafeBase::AddRef();
48 } 46 }
49 47
(...skipping 16 matching lines...) Expand all
66 64
67 scoped_refptr<SingleThreadTaskRunner> task_runner_; 65 scoped_refptr<SingleThreadTaskRunner> task_runner_;
68 66
69 private: 67 private:
70 DISALLOW_COPY_AND_ASSIGN(RefCountedDeleteOnMessageLoop); 68 DISALLOW_COPY_AND_ASSIGN(RefCountedDeleteOnMessageLoop);
71 }; 69 };
72 70
73 } // namespace base 71 } // namespace base
74 72
75 #endif // BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_ 73 #endif // BASE_MEMORY_REF_COUNTED_DELETE_ON_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view_unittest.cc ('k') | base/message_loop/message_loop_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698