| 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 #include "content/browser/appcache/appcache_response.h" | 5 #include "content/browser/appcache/appcache_response.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 public: | 34 public: |
| 35 explicit WrappedPickleIOBuffer(const base::Pickle* pickle) | 35 explicit WrappedPickleIOBuffer(const base::Pickle* pickle) |
| 36 : net::WrappedIOBuffer(reinterpret_cast<const char*>(pickle->data())), | 36 : net::WrappedIOBuffer(reinterpret_cast<const char*>(pickle->data())), |
| 37 pickle_(pickle) { | 37 pickle_(pickle) { |
| 38 DCHECK(pickle->data()); | 38 DCHECK(pickle->data()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 ~WrappedPickleIOBuffer() override {} | 42 ~WrappedPickleIOBuffer() override {} |
| 43 | 43 |
| 44 scoped_ptr<const base::Pickle> pickle_; | 44 std::unique_ptr<const base::Pickle> pickle_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // anon namespace | 47 } // anon namespace |
| 48 | 48 |
| 49 | 49 |
| 50 // AppCacheResponseInfo ---------------------------------------------- | 50 // AppCacheResponseInfo ---------------------------------------------- |
| 51 | 51 |
| 52 AppCacheResponseInfo::AppCacheResponseInfo(AppCacheStorage* storage, | 52 AppCacheResponseInfo::AppCacheResponseInfo(AppCacheStorage* storage, |
| 53 const GURL& manifest_url, | 53 const GURL& manifest_url, |
| 54 int64_t response_id, | 54 int64_t response_id, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 void AppCacheResponseReader::OnIOComplete(int result) { | 262 void AppCacheResponseReader::OnIOComplete(int result) { |
| 263 if (result >= 0) { | 263 if (result >= 0) { |
| 264 if (reading_metadata_size_) { | 264 if (reading_metadata_size_) { |
| 265 DCHECK(reading_metadata_size_ == result); | 265 DCHECK(reading_metadata_size_ == result); |
| 266 DCHECK(info_buffer_->http_info->metadata); | 266 DCHECK(info_buffer_->http_info->metadata); |
| 267 reading_metadata_size_ = 0; | 267 reading_metadata_size_ = 0; |
| 268 } else if (info_buffer_.get()) { | 268 } else if (info_buffer_.get()) { |
| 269 // Deserialize the http info structure, ensuring we got headers. | 269 // Deserialize the http info structure, ensuring we got headers. |
| 270 base::Pickle pickle(buffer_->data(), result); | 270 base::Pickle pickle(buffer_->data(), result); |
| 271 scoped_ptr<net::HttpResponseInfo> info(new net::HttpResponseInfo); | 271 std::unique_ptr<net::HttpResponseInfo> info(new net::HttpResponseInfo); |
| 272 bool response_truncated = false; | 272 bool response_truncated = false; |
| 273 if (!info->InitFromPickle(pickle, &response_truncated) || | 273 if (!info->InitFromPickle(pickle, &response_truncated) || |
| 274 !info->headers.get()) { | 274 !info->headers.get()) { |
| 275 InvokeUserCompletionCallback(net::ERR_FAILED); | 275 InvokeUserCompletionCallback(net::ERR_FAILED); |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 DCHECK(!response_truncated); | 278 DCHECK(!response_truncated); |
| 279 info_buffer_->http_info.reset(info.release()); | 279 info_buffer_->http_info.reset(info.release()); |
| 280 | 280 |
| 281 // Also return the size of the response body | 281 // Also return the size of the response body |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 491 } |
| 492 WriteRaw(kResponseMetadataIndex, 0, buffer_.get(), write_amount_); | 492 WriteRaw(kResponseMetadataIndex, 0, buffer_.get(), write_amount_); |
| 493 } | 493 } |
| 494 | 494 |
| 495 void AppCacheResponseMetadataWriter::OnIOComplete(int result) { | 495 void AppCacheResponseMetadataWriter::OnIOComplete(int result) { |
| 496 DCHECK(result < 0 || write_amount_ == result); | 496 DCHECK(result < 0 || write_amount_ == result); |
| 497 InvokeUserCompletionCallback(result); | 497 InvokeUserCompletionCallback(result); |
| 498 } | 498 } |
| 499 | 499 |
| 500 } // namespace content | 500 } // namespace content |
| OLD | NEW |