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 "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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 handling_206_(false), | 322 handling_206_(false), |
323 cache_pending_(false), | 323 cache_pending_(false), |
324 done_reading_(false), | 324 done_reading_(false), |
325 vary_mismatch_(false), | 325 vary_mismatch_(false), |
326 couldnt_conditionalize_request_(false), | 326 couldnt_conditionalize_request_(false), |
327 bypass_lock_for_test_(false), | 327 bypass_lock_for_test_(false), |
328 io_buf_len_(0), | 328 io_buf_len_(0), |
329 read_offset_(0), | 329 read_offset_(0), |
330 effective_load_flags_(0), | 330 effective_load_flags_(0), |
331 write_len_(0), | 331 write_len_(0), |
332 weak_factory_(this), | |
333 io_callback_(base::Bind(&Transaction::OnIOComplete, | |
334 weak_factory_.GetWeakPtr())), | |
335 transaction_pattern_(PATTERN_UNDEFINED), | 332 transaction_pattern_(PATTERN_UNDEFINED), |
336 total_received_bytes_(0), | 333 total_received_bytes_(0), |
337 websocket_handshake_stream_base_create_helper_(NULL) { | 334 websocket_handshake_stream_base_create_helper_(NULL), |
| 335 weak_factory_(this) { |
338 COMPILE_ASSERT(HttpCache::Transaction::kNumValidationHeaders == | 336 COMPILE_ASSERT(HttpCache::Transaction::kNumValidationHeaders == |
339 arraysize(kValidationHeaders), | 337 arraysize(kValidationHeaders), |
340 Invalid_number_of_validation_headers); | 338 Invalid_number_of_validation_headers); |
| 339 |
| 340 io_callback_ = base::Bind(&Transaction::OnIOComplete, |
| 341 weak_factory_.GetWeakPtr()); |
341 } | 342 } |
342 | 343 |
343 HttpCache::Transaction::~Transaction() { | 344 HttpCache::Transaction::~Transaction() { |
344 // We may have to issue another IO, but we should never invoke the callback_ | 345 // We may have to issue another IO, but we should never invoke the callback_ |
345 // after this point. | 346 // after this point. |
346 callback_.Reset(); | 347 callback_.Reset(); |
347 | 348 |
348 if (cache_) { | 349 if (cache_) { |
349 if (entry_) { | 350 if (entry_) { |
350 bool cancel_request = reading_ && response_.headers; | 351 bool cancel_request = reading_ && response_.headers; |
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2862 default: | 2863 default: |
2863 NOTREACHED(); | 2864 NOTREACHED(); |
2864 } | 2865 } |
2865 } | 2866 } |
2866 | 2867 |
2867 void HttpCache::Transaction::OnIOComplete(int result) { | 2868 void HttpCache::Transaction::OnIOComplete(int result) { |
2868 DoLoop(result); | 2869 DoLoop(result); |
2869 } | 2870 } |
2870 | 2871 |
2871 } // namespace net | 2872 } // namespace net |
OLD | NEW |