OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_JOB_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_JOB_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_JOB_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // net::URLRequestJob overrides | 45 // net::URLRequestJob overrides |
46 void Start() override; | 46 void Start() override; |
47 void Kill() override; | 47 void Kill() override; |
48 net::LoadState GetLoadState() const override; | 48 net::LoadState GetLoadState() const override; |
49 bool GetCharset(std::string* charset) override; | 49 bool GetCharset(std::string* charset) override; |
50 bool GetMimeType(std::string* mime_type) const override; | 50 bool GetMimeType(std::string* mime_type) const override; |
51 void GetResponseInfo(net::HttpResponseInfo* info) override; | 51 void GetResponseInfo(net::HttpResponseInfo* info) override; |
52 int GetResponseCode() const override; | 52 int GetResponseCode() const override; |
53 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; | 53 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; |
54 int ReadRawData(net::IOBuffer* buf, int buf_size) override; | 54 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override; |
55 | 55 |
56 // Reader completion callbacks. | 56 // Reader completion callbacks. |
57 void OnReadInfoComplete(int result); | 57 void OnReadInfoComplete(int result); |
58 void OnReadComplete(int result); | 58 void OnReadComplete(int result); |
59 | 59 |
60 // Helpers | 60 // Helpers |
61 void StartAsync(); | |
62 const net::HttpResponseInfo* http_info() const; | 61 const net::HttpResponseInfo* http_info() const; |
63 bool is_range_request() const { return range_requested_.IsValid(); } | 62 bool is_range_request() const { return range_requested_.IsValid(); } |
64 void SetupRangeResponse(int response_data_size); | 63 void SetupRangeResponse(int response_data_size); |
65 void Done(const net::URLRequestStatus& status); | 64 void Done(const net::URLRequestStatus& status); |
66 | 65 |
67 ResourceType resource_type_; | 66 ResourceType resource_type_; |
68 base::WeakPtr<ServiceWorkerContextCore> context_; | 67 base::WeakPtr<ServiceWorkerContextCore> context_; |
69 scoped_refptr<ServiceWorkerVersion> version_; | 68 scoped_refptr<ServiceWorkerVersion> version_; |
70 int64 resource_id_; | 69 int64 resource_id_; |
71 scoped_ptr<ServiceWorkerResponseReader> reader_; | 70 scoped_ptr<ServiceWorkerResponseReader> reader_; |
72 scoped_refptr<HttpResponseInfoIOBuffer> http_info_io_buffer_; | 71 scoped_refptr<HttpResponseInfoIOBuffer> http_info_io_buffer_; |
73 scoped_ptr<net::HttpResponseInfo> http_info_; | 72 scoped_ptr<net::HttpResponseInfo> http_info_; |
74 net::HttpByteRange range_requested_; | 73 net::HttpByteRange range_requested_; |
75 scoped_ptr<net::HttpResponseInfo> range_response_info_; | 74 scoped_ptr<net::HttpResponseInfo> range_response_info_; |
76 bool has_been_killed_; | 75 bool has_been_killed_; |
77 base::WeakPtrFactory<ServiceWorkerReadFromCacheJob> weak_factory_; | 76 base::WeakPtrFactory<ServiceWorkerReadFromCacheJob> weak_factory_; |
78 | 77 |
79 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerReadFromCacheJob); | 78 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerReadFromCacheJob); |
80 }; | 79 }; |
81 | 80 |
82 } // namespace content | 81 } // namespace content |
83 | 82 |
84 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_JOB_H_ | 83 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_JOB_H_ |
OLD | NEW |