Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: net/url_request/url_request_simple_job.h

Issue 1467603002: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add done_reading_called_ to MockNetworkTransaction Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_job_unittest.cc ('k') | net/url_request/url_request_simple_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 namespace net { 21 namespace net {
22 22
23 class URLRequest; 23 class URLRequest;
24 24
25 class NET_EXPORT URLRequestSimpleJob : public URLRangeRequestJob { 25 class NET_EXPORT URLRequestSimpleJob : public URLRangeRequestJob {
26 public: 26 public:
27 URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate); 27 URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate);
28 28
29 void Start() override; 29 void Start() override;
30 void Kill() override; 30 void Kill() override;
31 bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override; 31 int ReadRawData(IOBuffer* buf, int buf_size) override;
32 bool GetMimeType(std::string* mime_type) const override; 32 bool GetMimeType(std::string* mime_type) const override;
33 bool GetCharset(std::string* charset) override; 33 bool GetCharset(std::string* charset) override;
34 34
35 protected: 35 protected:
36 ~URLRequestSimpleJob() override; 36 ~URLRequestSimpleJob() override;
37 37
38 // Subclasses must override either GetData or GetRefCountedData to define the 38 // Subclasses must override either GetData or GetRefCountedData to define the
39 // way response data is determined. 39 // way response data is determined.
40 // The return value should be: 40 // The return value should be:
41 // - OK if data is obtained; 41 // - OK if data is obtained;
(...skipping 17 matching lines...) Expand all
59 const CompletionCallback& callback) const; 59 const CompletionCallback& callback) const;
60 60
61 // Returns the task runner used by ReadRawData. This method is virtual so 61 // Returns the task runner used by ReadRawData. This method is virtual so
62 // that it can be overridden in tests. 62 // that it can be overridden in tests.
63 virtual base::TaskRunner* GetTaskRunner() const; 63 virtual base::TaskRunner* GetTaskRunner() const;
64 64
65 void StartAsync(); 65 void StartAsync();
66 66
67 private: 67 private:
68 void OnGetDataCompleted(int result); 68 void OnGetDataCompleted(int result);
69 void OnReadCompleted(int bytes_read);
70 69
71 HttpByteRange byte_range_; 70 HttpByteRange byte_range_;
72 std::string mime_type_; 71 std::string mime_type_;
73 std::string charset_; 72 std::string charset_;
74 scoped_refptr<base::RefCountedMemory> data_; 73 scoped_refptr<base::RefCountedMemory> data_;
75 int64 next_data_offset_; 74 int64 next_data_offset_;
76 scoped_refptr<base::TaskRunner> task_runner_; 75 scoped_refptr<base::TaskRunner> task_runner_;
77 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; 76 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_;
78 }; 77 };
79 78
80 } // namespace net 79 } // namespace net
81 80
82 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ 81 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_unittest.cc ('k') | net/url_request/url_request_simple_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698