Chromium Code Reviews| Index: net/url_request/url_request_simple_job.h |
| diff --git a/net/url_request/url_request_simple_job.h b/net/url_request/url_request_simple_job.h |
| index 85d8f7e39edfa29edbdf26e7be96cccb11e157cc..734b99838a91fd68ef71de35713229bcd2615494 100644 |
| --- a/net/url_request/url_request_simple_job.h |
| +++ b/net/url_request/url_request_simple_job.h |
| @@ -8,6 +8,7 @@ |
| #include <string> |
| #include "base/memory/weak_ptr.h" |
| +#include "base/strings/string_piece.h" |
| #include "net/base/completion_callback.h" |
| #include "net/base/net_export.h" |
| #include "net/url_request/url_range_request_job.h" |
| @@ -41,7 +42,13 @@ class NET_EXPORT URLRequestSimpleJob : public URLRangeRequestJob { |
| virtual int GetData(std::string* mime_type, |
| std::string* charset, |
| std::string* data, |
| - const CompletionCallback& callback) const = 0; |
| + const CompletionCallback& callback) const; |
| + // Similar to GetData(), except the subclass must ensure that the characters |
| + // referred to by *data live at least as long as *this. |
| + virtual int GetStringPieceData(std::string* mime_type, |
| + std::string* charset, |
| + base::StringPiece* data, |
| + const CompletionCallback& callback); |
|
mmenke
2014/11/14 22:46:40
Could be instead take a base::RefCountedMemory? S
Jeffrey Yasskin
2014/11/15 02:34:20
Ah, that's definitely better; thanks! I'm inclined
|
| protected: |
| void StartAsync(); |
| @@ -52,7 +59,8 @@ class NET_EXPORT URLRequestSimpleJob : public URLRangeRequestJob { |
| HttpByteRange byte_range_; |
| std::string mime_type_; |
| std::string charset_; |
| - std::string data_; |
| + std::string data_storage_; |
| + base::StringPiece data_; |
| int data_offset_; |
| base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; |
| }; |