| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |