| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_APPCACHE_APPCACHE_RESPONSE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 const GURL& manifest_url() const { return manifest_url_; } | 42 const GURL& manifest_url() const { return manifest_url_; } |
| 43 int64 response_id() const { return response_id_; } | 43 int64 response_id() const { return response_id_; } |
| 44 const net::HttpResponseInfo* http_response_info() const { | 44 const net::HttpResponseInfo* http_response_info() const { |
| 45 return http_response_info_.get(); | 45 return http_response_info_.get(); |
| 46 } | 46 } |
| 47 int64 response_data_size() const { return response_data_size_; } | 47 int64 response_data_size() const { return response_data_size_; } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 friend class base::RefCounted<AppCacheResponseInfo>; | 50 friend class base::RefCounted<AppCacheResponseInfo>; |
| 51 ~AppCacheResponseInfo(); | 51 virtual ~AppCacheResponseInfo(); |
| 52 | 52 |
| 53 const GURL manifest_url_; | 53 const GURL manifest_url_; |
| 54 const int64 response_id_; | 54 const int64 response_id_; |
| 55 const scoped_ptr<net::HttpResponseInfo> http_response_info_; | 55 const scoped_ptr<net::HttpResponseInfo> http_response_info_; |
| 56 const int64 response_data_size_; | 56 const int64 response_data_size_; |
| 57 const AppCacheService* service_; | 57 const AppCacheService* service_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // A refcounted wrapper for HttpResponseInfo so we can apply the | 60 // A refcounted wrapper for HttpResponseInfo so we can apply the |
| 61 // refcounting semantics used with IOBuffer with these structures too. | 61 // refcounting semantics used with IOBuffer with these structures too. |
| 62 struct HttpResponseInfoIOBuffer | 62 struct HttpResponseInfoIOBuffer |
| 63 : public base::RefCountedThreadSafe<HttpResponseInfoIOBuffer> { | 63 : public base::RefCountedThreadSafe<HttpResponseInfoIOBuffer> { |
| 64 scoped_ptr<net::HttpResponseInfo> http_info; | 64 scoped_ptr<net::HttpResponseInfo> http_info; |
| 65 int response_data_size; | 65 int response_data_size; |
| 66 | 66 |
| 67 HttpResponseInfoIOBuffer() | 67 HttpResponseInfoIOBuffer(); |
| 68 : response_data_size(kUnkownResponseDataSize) {} | 68 explicit HttpResponseInfoIOBuffer(net::HttpResponseInfo* info); |
| 69 explicit HttpResponseInfoIOBuffer(net::HttpResponseInfo* info) | |
| 70 : http_info(info), response_data_size(kUnkownResponseDataSize) {} | |
| 71 | 69 |
| 72 private: | 70 private: |
| 73 friend class base::RefCountedThreadSafe<HttpResponseInfoIOBuffer>; | 71 friend class base::RefCountedThreadSafe<HttpResponseInfoIOBuffer>; |
| 74 | 72 virtual ~HttpResponseInfoIOBuffer(); |
| 75 ~HttpResponseInfoIOBuffer() {} | |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 // Common base class for response reader and writer. | 75 // Common base class for response reader and writer. |
| 79 class AppCacheResponseIO { | 76 class AppCacheResponseIO { |
| 80 public: | 77 public: |
| 81 virtual ~AppCacheResponseIO(); | 78 virtual ~AppCacheResponseIO(); |
| 82 int64 response_id() const { return response_id_; } | 79 int64 response_id() const { return response_id_; } |
| 83 | 80 |
| 84 protected: | 81 protected: |
| 85 friend class ScopedRunnableMethodFactory<AppCacheResponseIO>; | 82 friend class ScopedRunnableMethodFactory<AppCacheResponseIO>; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 int write_position_; | 238 int write_position_; |
| 242 int write_amount_; | 239 int write_amount_; |
| 243 CreationPhase creation_phase_; | 240 CreationPhase creation_phase_; |
| 244 scoped_refptr<EntryCallback<AppCacheResponseWriter> > create_callback_; | 241 scoped_refptr<EntryCallback<AppCacheResponseWriter> > create_callback_; |
| 245 }; | 242 }; |
| 246 | 243 |
| 247 } // namespace appcache | 244 } // namespace appcache |
| 248 | 245 |
| 249 #endif // WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ | 246 #endif // WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ |
| 250 | 247 |
| OLD | NEW |