| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TASK_RUNNER_H_ | 5 #ifndef BASE_TASK_RUNNER_H_ |
| 6 #define BASE_TASK_RUNNER_H_ | 6 #define BASE_TASK_RUNNER_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // // Called to add data into a buffer. | 97 // // Called to add data into a buffer. |
| 98 // void AddData(void* buf, size_t length); | 98 // void AddData(void* buf, size_t length); |
| 99 // ... | 99 // ... |
| 100 // }; | 100 // }; |
| 101 // | 101 // |
| 102 // | 102 // |
| 103 // class DataLoader : public SupportsWeakPtr<DataLoader> { | 103 // class DataLoader : public SupportsWeakPtr<DataLoader> { |
| 104 // public: | 104 // public: |
| 105 // void GetData() { | 105 // void GetData() { |
| 106 // scoped_refptr<DataBuffer> buffer = new DataBuffer(); | 106 // scoped_refptr<DataBuffer> buffer = new DataBuffer(); |
| 107 // target_thread_.message_loop_proxy()->PostTaskAndReply( | 107 // target_thread_.task_runner()->PostTaskAndReply( |
| 108 // FROM_HERE, | 108 // FROM_HERE, |
| 109 // base::Bind(&DataBuffer::AddData, buffer), | 109 // base::Bind(&DataBuffer::AddData, buffer), |
| 110 // base::Bind(&DataLoader::OnDataReceived, AsWeakPtr(), buffer)); | 110 // base::Bind(&DataLoader::OnDataReceived, AsWeakPtr(), buffer)); |
| 111 // } | 111 // } |
| 112 // | 112 // |
| 113 // private: | 113 // private: |
| 114 // void OnDataReceived(scoped_refptr<DataBuffer> buffer) { | 114 // void OnDataReceived(scoped_refptr<DataBuffer> buffer) { |
| 115 // // Do something with buffer. | 115 // // Do something with buffer. |
| 116 // } | 116 // } |
| 117 // }; | 117 // }; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 144 virtual void OnDestruct() const; | 144 virtual void OnDestruct() const; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 struct BASE_EXPORT TaskRunnerTraits { | 147 struct BASE_EXPORT TaskRunnerTraits { |
| 148 static void Destruct(const TaskRunner* task_runner); | 148 static void Destruct(const TaskRunner* task_runner); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace base | 151 } // namespace base |
| 152 | 152 |
| 153 #endif // BASE_TASK_RUNNER_H_ | 153 #endif // BASE_TASK_RUNNER_H_ |
| OLD | NEW |