| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_MESSAGE_LOOP_PROXY_H_ | 5 #ifndef BASE_MESSAGE_LOOP_PROXY_H_ |
| 6 #define BASE_MESSAGE_LOOP_PROXY_H_ | 6 #define BASE_MESSAGE_LOOP_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/base_export.h" | 9 #include "base/base_export.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // canceled. See the following pseudo-code: | 80 // canceled. See the following pseudo-code: |
| 81 // | 81 // |
| 82 // class DataBuffer : public RefCountedThreadSafe<DataBuffer> { | 82 // class DataBuffer : public RefCountedThreadSafe<DataBuffer> { |
| 83 // public: | 83 // public: |
| 84 // // Called to add data into a buffer. | 84 // // Called to add data into a buffer. |
| 85 // void AddData(void* buf, size_t length); | 85 // void AddData(void* buf, size_t length); |
| 86 // ... | 86 // ... |
| 87 // }; | 87 // }; |
| 88 // | 88 // |
| 89 // | 89 // |
| 90 // class DataLoader : public SupportsWeakPtr<ReadToBuffer> { | 90 // class DataLoader : public SupportsWeakPtr<DataLoader> { |
| 91 // public: | 91 // public: |
| 92 // void GetData() { | 92 // void GetData() { |
| 93 // scoped_refptr<DataBuffer> buffer = new DataBuffer(); | 93 // scoped_refptr<DataBuffer> buffer = new DataBuffer(); |
| 94 // target_thread_.message_loop_proxy()->PostTaskAndReply( | 94 // target_thread_.message_loop_proxy()->PostTaskAndReply( |
| 95 // FROM_HERE, | 95 // FROM_HERE, |
| 96 // base::Bind(&DataBuffer::AddData, buffer), | 96 // base::Bind(&DataBuffer::AddData, buffer), |
| 97 // base::Bind(&DataLoader::OnDataReceived, AsWeakPtr(), buffer)); | 97 // base::Bind(&DataLoader::OnDataReceived, AsWeakPtr(), buffer)); |
| 98 // } | 98 // } |
| 99 // | 99 // |
| 100 // private: | 100 // private: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 struct MessageLoopProxyTraits { | 145 struct MessageLoopProxyTraits { |
| 146 static void Destruct(const MessageLoopProxy* proxy) { | 146 static void Destruct(const MessageLoopProxy* proxy) { |
| 147 proxy->OnDestruct(); | 147 proxy->OnDestruct(); |
| 148 } | 148 } |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace base | 151 } // namespace base |
| 152 | 152 |
| 153 #endif // BASE_MESSAGE_LOOP_PROXY_H_ | 153 #endif // BASE_MESSAGE_LOOP_PROXY_H_ |
| OLD | NEW |