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

Side by Side Diff: content/browser/android/url_request_content_job.h

Issue 1439953006: Reland: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address David's comment Created 5 years, 1 month 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 CONTENT_BROWSER_ANDROID_URL_REQUEST_CONTENT_JOB_H_ 5 #ifndef CONTENT_BROWSER_ANDROID_URL_REQUEST_CONTENT_JOB_H_
6 #define CONTENT_BROWSER_ANDROID_URL_REQUEST_CONTENT_JOB_H_ 6 #define CONTENT_BROWSER_ANDROID_URL_REQUEST_CONTENT_JOB_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "net/base/net_errors.h"
15 #include "net/http/http_byte_range.h" 16 #include "net/http/http_byte_range.h"
16 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
17 #include "net/url_request/url_request_job.h" 18 #include "net/url_request/url_request_job.h"
18 19
19 namespace base { 20 namespace base {
20 class TaskRunner; 21 class TaskRunner;
21 } 22 }
22 23
23 namespace file_util { 24 namespace file_util {
24 struct FileInfo; 25 struct FileInfo;
(...skipping 10 matching lines...) Expand all
35 public: 36 public:
36 URLRequestContentJob( 37 URLRequestContentJob(
37 net::URLRequest* request, 38 net::URLRequest* request,
38 net::NetworkDelegate* network_delegate, 39 net::NetworkDelegate* network_delegate,
39 const base::FilePath& content_path, 40 const base::FilePath& content_path,
40 const scoped_refptr<base::TaskRunner>& content_task_runner); 41 const scoped_refptr<base::TaskRunner>& content_task_runner);
41 42
42 // net::URLRequestJob: 43 // net::URLRequestJob:
43 void Start() override; 44 void Start() override;
44 void Kill() override; 45 void Kill() override;
45 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override; 46 int ReadRawData(net::IOBuffer* buf, int buf_size) override;
46 bool IsRedirectResponse(GURL* location, int* http_status_code) override; 47 bool IsRedirectResponse(GURL* location, int* http_status_code) override;
47 bool GetMimeType(std::string* mime_type) const override; 48 bool GetMimeType(std::string* mime_type) const override;
48 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; 49 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
49 50
50 protected: 51 protected:
51 ~URLRequestContentJob() override; 52 ~URLRequestContentJob() override;
52 53
53 private: 54 private:
54 // Meta information about the content URI. It's used as a member in the 55 // Meta information about the content URI. It's used as a member in the
55 // URLRequestContentJob and also passed between threads because disk access is 56 // URLRequestContentJob and also passed between threads because disk access is
(...skipping 16 matching lines...) Expand all
72 void DidFetchMetaInfo(const ContentMetaInfo* meta_info); 73 void DidFetchMetaInfo(const ContentMetaInfo* meta_info);
73 74
74 // Callback after opening content URI on a background thread. 75 // Callback after opening content URI on a background thread.
75 void DidOpen(int result); 76 void DidOpen(int result);
76 77
77 // Callback after seeking to the beginning of |byte_range_| in the content URI 78 // Callback after seeking to the beginning of |byte_range_| in the content URI
78 // on a background thread. 79 // on a background thread.
79 void DidSeek(int64 result); 80 void DidSeek(int64 result);
80 81
81 // Callback after data is asynchronously read from the content URI into |buf|. 82 // Callback after data is asynchronously read from the content URI into |buf|.
82 void DidRead(scoped_refptr<net::IOBuffer> buf, int result); 83 void DidRead(int result);
83 84
84 // The full path of the content URI. 85 // The full path of the content URI.
85 base::FilePath content_path_; 86 base::FilePath content_path_;
86 87
87 scoped_ptr<net::FileStream> stream_; 88 scoped_ptr<net::FileStream> stream_;
88 ContentMetaInfo meta_info_; 89 ContentMetaInfo meta_info_;
89 const scoped_refptr<base::TaskRunner> content_task_runner_; 90 const scoped_refptr<base::TaskRunner> content_task_runner_;
90 91
91 net::HttpByteRange byte_range_; 92 net::HttpByteRange byte_range_;
93 net::Error range_parse_result_;
92 int64 remaining_bytes_; 94 int64 remaining_bytes_;
93 95
94 bool io_pending_; 96 bool io_pending_;
95 97
96 base::WeakPtrFactory<URLRequestContentJob> weak_ptr_factory_; 98 base::WeakPtrFactory<URLRequestContentJob> weak_ptr_factory_;
97 99
98 DISALLOW_COPY_AND_ASSIGN(URLRequestContentJob); 100 DISALLOW_COPY_AND_ASSIGN(URLRequestContentJob);
99 }; 101 };
100 102
101 } // namespace content 103 } // namespace content
102 104
103 #endif // CONTENT_BROWSER_ANDROID_URL_REQUEST_CONTENT_JOB_H_ 105 #endif // CONTENT_BROWSER_ANDROID_URL_REQUEST_CONTENT_JOB_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/fileapi/external_file_url_request_job.cc ('k') | content/browser/android/url_request_content_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698