OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/http/http_cache_transaction.h" | 5 #include "net/http/http_cache_transaction.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 } | 1794 } |
1795 | 1795 |
1796 // When writing headers, we normally only write the non-transient | 1796 // When writing headers, we normally only write the non-transient |
1797 // headers; when in record mode, record everything. | 1797 // headers; when in record mode, record everything. |
1798 bool skip_transient_headers = (cache_->mode() != RECORD); | 1798 bool skip_transient_headers = (cache_->mode() != RECORD); |
1799 | 1799 |
1800 if (truncated) { | 1800 if (truncated) { |
1801 DCHECK_EQ(200, response_.headers->response_code()); | 1801 DCHECK_EQ(200, response_.headers->response_code()); |
1802 } | 1802 } |
1803 | 1803 |
1804 scoped_refptr<PickledIOBuffer> data = new PickledIOBuffer(); | 1804 scoped_refptr<PickledIOBuffer> data(new PickledIOBuffer()); |
1805 response_.Persist(data->pickle(), skip_transient_headers, truncated); | 1805 response_.Persist(data->pickle(), skip_transient_headers, truncated); |
1806 data->Done(); | 1806 data->Done(); |
1807 | 1807 |
1808 // Balanced in DoCacheWriteResponseComplete. We may be running from the | 1808 // Balanced in DoCacheWriteResponseComplete. We may be running from the |
1809 // destructor of this object so cache_callback_ may be currently in use. | 1809 // destructor of this object so cache_callback_ may be currently in use. |
1810 write_headers_callback_->AddRef(); | 1810 write_headers_callback_->AddRef(); |
1811 io_buf_len_ = data->pickle()->size(); | 1811 io_buf_len_ = data->pickle()->size(); |
1812 return entry_->disk_entry->WriteData(kResponseInfoIndex, 0, data, io_buf_len_, | 1812 return entry_->disk_entry->WriteData(kResponseInfoIndex, 0, data, io_buf_len_, |
1813 write_headers_callback_, true); | 1813 write_headers_callback_, true); |
1814 } | 1814 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 // |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f) | 1906 // |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f) |
1907 // but we'll see. | 1907 // but we'll see. |
1908 UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65); | 1908 UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65); |
1909 } | 1909 } |
1910 | 1910 |
1911 void HttpCache::Transaction::OnIOComplete(int result) { | 1911 void HttpCache::Transaction::OnIOComplete(int result) { |
1912 DoLoop(result); | 1912 DoLoop(result); |
1913 } | 1913 } |
1914 | 1914 |
1915 } // namespace net | 1915 } // namespace net |
OLD | NEW |