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 WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ | 5 #ifndef WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ |
6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ | 6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace webkit_blob { | 27 namespace webkit_blob { |
28 | 28 |
29 class LocalFileReader; | 29 class LocalFileReader; |
30 | 30 |
31 // A request job that handles reading blob URLs. | 31 // A request job that handles reading blob URLs. |
32 class BLOB_EXPORT BlobURLRequestJob : public net::URLRequestJob { | 32 class BLOB_EXPORT BlobURLRequestJob : public net::URLRequestJob { |
33 public: | 33 public: |
34 BlobURLRequestJob(net::URLRequest* request, | 34 BlobURLRequestJob(net::URLRequest* request, |
35 BlobData* blob_data, | 35 BlobData* blob_data, |
36 base::MessageLoopProxy* resolving_message_loop_proxy); | 36 base::MessageLoopProxy* resolving_message_loop_proxy); |
37 virtual ~BlobURLRequestJob(); | |
38 | 37 |
39 // net::URLRequestJob methods. | 38 // net::URLRequestJob methods. |
40 virtual void Start() OVERRIDE; | 39 virtual void Start() OVERRIDE; |
41 virtual void Kill() OVERRIDE; | 40 virtual void Kill() OVERRIDE; |
42 virtual bool ReadRawData(net::IOBuffer* buf, | 41 virtual bool ReadRawData(net::IOBuffer* buf, |
43 int buf_size, | 42 int buf_size, |
44 int* bytes_read) OVERRIDE; | 43 int* bytes_read) OVERRIDE; |
45 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 44 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
46 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; | 45 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; |
47 virtual int GetResponseCode() const OVERRIDE; | 46 virtual int GetResponseCode() const OVERRIDE; |
48 virtual void SetExtraRequestHeaders( | 47 virtual void SetExtraRequestHeaders( |
49 const net::HttpRequestHeaders& headers) OVERRIDE; | 48 const net::HttpRequestHeaders& headers) OVERRIDE; |
50 | 49 |
| 50 protected: |
| 51 virtual ~BlobURLRequestJob(); |
| 52 |
51 private: | 53 private: |
52 typedef std::map<size_t, LocalFileReader*> IndexToReaderMap; | 54 typedef std::map<size_t, LocalFileReader*> IndexToReaderMap; |
53 | 55 |
54 // For preparing for read: get the size, apply the range and perform seek. | 56 // For preparing for read: get the size, apply the range and perform seek. |
55 void DidStart(); | 57 void DidStart(); |
56 void CountSize(); | 58 void CountSize(); |
57 void DidCountSize(int error); | 59 void DidCountSize(int error); |
58 void DidGetFileItemLength(size_t index, int64 result); | 60 void DidGetFileItemLength(size_t index, int64 result); |
59 void Seek(int64 offset); | 61 void Seek(int64 offset); |
60 | 62 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bool byte_range_set_; | 98 bool byte_range_set_; |
97 net::HttpByteRange byte_range_; | 99 net::HttpByteRange byte_range_; |
98 scoped_ptr<net::HttpResponseInfo> response_info_; | 100 scoped_ptr<net::HttpResponseInfo> response_info_; |
99 | 101 |
100 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); | 102 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); |
101 }; | 103 }; |
102 | 104 |
103 } // namespace webkit_blob | 105 } // namespace webkit_blob |
104 | 106 |
105 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ | 107 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ |
OLD | NEW |