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 17 matching lines...) Expand all Loading... |
28 ServiceWorkerReadFromCacheJob( | 28 ServiceWorkerReadFromCacheJob( |
29 net::URLRequest* request, | 29 net::URLRequest* request, |
30 net::NetworkDelegate* network_delegate, | 30 net::NetworkDelegate* network_delegate, |
31 base::WeakPtr<ServiceWorkerContextCore> context, | 31 base::WeakPtr<ServiceWorkerContextCore> context, |
32 int64 response_id); | 32 int64 response_id); |
33 | 33 |
34 private: | 34 private: |
35 virtual ~ServiceWorkerReadFromCacheJob(); | 35 virtual ~ServiceWorkerReadFromCacheJob(); |
36 | 36 |
37 // net::URLRequestJob overrides | 37 // net::URLRequestJob overrides |
38 virtual void Start() OVERRIDE; | 38 virtual void Start() override; |
39 virtual void Kill() OVERRIDE; | 39 virtual void Kill() override; |
40 virtual net::LoadState GetLoadState() const OVERRIDE; | 40 virtual net::LoadState GetLoadState() const override; |
41 virtual bool GetCharset(std::string* charset) OVERRIDE; | 41 virtual bool GetCharset(std::string* charset) override; |
42 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 42 virtual bool GetMimeType(std::string* mime_type) const override; |
43 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; | 43 virtual void GetResponseInfo(net::HttpResponseInfo* info) override; |
44 virtual int GetResponseCode() const OVERRIDE; | 44 virtual int GetResponseCode() const override; |
45 virtual void SetExtraRequestHeaders( | 45 virtual void SetExtraRequestHeaders( |
46 const net::HttpRequestHeaders& headers) OVERRIDE; | 46 const net::HttpRequestHeaders& headers) override; |
47 virtual bool ReadRawData(net::IOBuffer* buf, | 47 virtual bool ReadRawData(net::IOBuffer* buf, |
48 int buf_size, | 48 int buf_size, |
49 int *bytes_read) OVERRIDE; | 49 int *bytes_read) override; |
50 | 50 |
51 // Reader completion callbacks. | 51 // Reader completion callbacks. |
52 void OnReadInfoComplete(int result); | 52 void OnReadInfoComplete(int result); |
53 void OnReadComplete(int result); | 53 void OnReadComplete(int result); |
54 | 54 |
55 // Helpers | 55 // Helpers |
56 const net::HttpResponseInfo* http_info() const; | 56 const net::HttpResponseInfo* http_info() const; |
57 bool is_range_request() const { return range_requested_.IsValid(); } | 57 bool is_range_request() const { return range_requested_.IsValid(); } |
58 void SetupRangeResponse(int response_data_size); | 58 void SetupRangeResponse(int response_data_size); |
59 | 59 |
60 base::WeakPtr<ServiceWorkerContextCore> context_; | 60 base::WeakPtr<ServiceWorkerContextCore> context_; |
61 int64 response_id_; | 61 int64 response_id_; |
62 scoped_ptr<ServiceWorkerResponseReader> reader_; | 62 scoped_ptr<ServiceWorkerResponseReader> reader_; |
63 scoped_refptr<HttpResponseInfoIOBuffer> http_info_io_buffer_; | 63 scoped_refptr<HttpResponseInfoIOBuffer> http_info_io_buffer_; |
64 scoped_ptr<net::HttpResponseInfo> http_info_; | 64 scoped_ptr<net::HttpResponseInfo> http_info_; |
65 net::HttpByteRange range_requested_; | 65 net::HttpByteRange range_requested_; |
66 scoped_ptr<net::HttpResponseInfo> range_response_info_; | 66 scoped_ptr<net::HttpResponseInfo> range_response_info_; |
67 bool has_been_killed_; | 67 bool has_been_killed_; |
68 base::WeakPtrFactory<ServiceWorkerReadFromCacheJob> weak_factory_; | 68 base::WeakPtrFactory<ServiceWorkerReadFromCacheJob> weak_factory_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerReadFromCacheJob); | 70 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerReadFromCacheJob); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace content | 73 } // namespace content |
74 | 74 |
75 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_JOB_H_ | 75 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_READ_FROM_CACHE_JOB_H_ |
OLD | NEW |