| 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 NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 std::string* data, | 50 std::string* data, |
| 51 const CompletionCallback& callback) const; | 51 const CompletionCallback& callback) const; |
| 52 | 52 |
| 53 // Similar to GetData(), except |*data| can share ownership of the bytes | 53 // Similar to GetData(), except |*data| can share ownership of the bytes |
| 54 // instead of copying them into a std::string. | 54 // instead of copying them into a std::string. |
| 55 virtual int GetRefCountedData(std::string* mime_type, | 55 virtual int GetRefCountedData(std::string* mime_type, |
| 56 std::string* charset, | 56 std::string* charset, |
| 57 scoped_refptr<base::RefCountedMemory>* data, | 57 scoped_refptr<base::RefCountedMemory>* data, |
| 58 const CompletionCallback& callback) const; | 58 const CompletionCallback& callback) const; |
| 59 | 59 |
| 60 // Returns the task runner used by ReadRawData. This method is virtual so |
| 61 // that it can be overridden in tests. |
| 62 virtual base::TaskRunner* GetTaskRunner() const; |
| 63 |
| 60 void StartAsync(); | 64 void StartAsync(); |
| 61 | 65 |
| 62 private: | 66 private: |
| 63 void OnGetDataCompleted(int result); | 67 void OnGetDataCompleted(int result); |
| 68 void OnReadCompleted(int bytes_read); |
| 64 | 69 |
| 65 HttpByteRange byte_range_; | 70 HttpByteRange byte_range_; |
| 66 std::string mime_type_; | 71 std::string mime_type_; |
| 67 std::string charset_; | 72 std::string charset_; |
| 68 scoped_refptr<base::RefCountedMemory> data_; | 73 scoped_refptr<base::RefCountedMemory> data_; |
| 69 int64 data_offset_; | 74 int64 next_data_offset_; |
| 75 scoped_refptr<base::TaskRunner> task_runner_; |
| 70 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; | 76 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; |
| 71 }; | 77 }; |
| 72 | 78 |
| 73 } // namespace net | 79 } // namespace net |
| 74 | 80 |
| 75 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ | 81 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ |
| OLD | NEW |