| OLD | NEW |
| 1 // This file was GENERATED by command: | 1 // This file was GENERATED by command: |
| 2 // pump.py callback_helper.h.pump | 2 // pump.py callback_helper.h.pump |
| 3 // DO NOT EDIT BY HAND!!! | 3 // DO NOT EDIT BY HAND!!! |
| 4 | 4 |
| 5 | 5 |
| 6 // Copyright 2014 The Chromium Authors. All rights reserved. | 6 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 7 // Use of this source code is governed by a BSD-style license that can be | 7 // Use of this source code is governed by a BSD-style license that can be |
| 8 // found in the LICENSE file. | 8 // found in the LICENSE file. |
| 9 | 9 |
| 10 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 10 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 template <typename T> | 42 template <typename T> |
| 43 class CallbackHolder { | 43 class CallbackHolder { |
| 44 public: | 44 public: |
| 45 CallbackHolder(base::SequencedTaskRunner* task_runner, | 45 CallbackHolder(base::SequencedTaskRunner* task_runner, |
| 46 const tracked_objects::Location& from_here, | 46 const tracked_objects::Location& from_here, |
| 47 const base::Callback<T>& callback) | 47 const base::Callback<T>& callback) |
| 48 : task_runner_(task_runner), | 48 : task_runner_(task_runner), |
| 49 from_here_(from_here), | 49 from_here_(from_here), |
| 50 callback_(new base::Callback<T>(callback)) { | 50 callback_(new base::Callback<T>(callback)) { |
| 51 DCHECK(task_runner_); | 51 DCHECK(task_runner_.get()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 ~CallbackHolder() { | 54 ~CallbackHolder() { |
| 55 base::Callback<T>* callback = callback_.release(); | 55 base::Callback<T>* callback = callback_.release(); |
| 56 if (!task_runner_->DeleteSoon(from_here_, callback)) | 56 if (!task_runner_->DeleteSoon(from_here_, callback)) |
| 57 delete callback; | 57 delete callback; |
| 58 } | 58 } |
| 59 | 59 |
| 60 base::SequencedTaskRunner* task_runner() const { return task_runner_; } | 60 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } |
| 61 const tracked_objects::Location& from_here() const { return from_here_; } | 61 const tracked_objects::Location& from_here() const { return from_here_; } |
| 62 const base::Callback<T>& callback() const { return *callback_; } | 62 const base::Callback<T>& callback() const { return *callback_; } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 65 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 66 const tracked_objects::Location from_here_; | 66 const tracked_objects::Location from_here_; |
| 67 scoped_ptr<base::Callback<T> > callback_; | 67 scoped_ptr<base::Callback<T> > callback_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(CallbackHolder); | 69 DISALLOW_COPY_AND_ASSIGN(CallbackHolder); |
| 70 }; | 70 }; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 const base::Callback<T>& callback) { | 175 const base::Callback<T>& callback) { |
| 176 return RelayCallbackToTaskRunner( | 176 return RelayCallbackToTaskRunner( |
| 177 base::ThreadTaskRunnerHandle::Get(), | 177 base::ThreadTaskRunnerHandle::Get(), |
| 178 from_here, callback); | 178 from_here, callback); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace drive_backend | 181 } // namespace drive_backend |
| 182 } // namespace sync_file_system | 182 } // namespace sync_file_system |
| 183 | 183 |
| 184 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 184 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ |
| OLD | NEW |