| 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.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| 11 #if defined(OS_POSIX) | 11 #if defined(OS_POSIX) |
| 12 #include <unistd.h> | 12 #include <unistd.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
| 19 #include "base/format_macros.h" | 19 #include "base/format_macros.h" |
| 20 #include "base/location.h" | 20 #include "base/location.h" |
| 21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 22 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
| 23 #include "base/metrics/field_trial.h" | 23 #include "base/metrics/field_trial.h" |
| 24 #include "base/metrics/histogram.h" | 24 #include "base/metrics/histogram.h" |
| 25 #include "base/pickle.h" | 25 #include "base/pickle.h" |
| 26 #include "base/profiler/scoped_tracker.h" | |
| 27 #include "base/stl_util.h" | 26 #include "base/stl_util.h" |
| 28 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
| 29 #include "base/strings/string_util.h" | 28 #include "base/strings/string_util.h" |
| 30 #include "base/strings/stringprintf.h" | 29 #include "base/strings/stringprintf.h" |
| 31 #include "base/threading/worker_pool.h" | 30 #include "base/threading/worker_pool.h" |
| 32 #include "base/time/default_clock.h" | 31 #include "base/time/default_clock.h" |
| 33 #include "base/time/time.h" | 32 #include "base/time/time.h" |
| 34 #include "net/base/cache_type.h" | 33 #include "net/base/cache_type.h" |
| 35 #include "net/base/io_buffer.h" | 34 #include "net/base/io_buffer.h" |
| 36 #include "net/base/load_flags.h" | 35 #include "net/base/load_flags.h" |
| (...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 item->NotifyTransaction(result, entry); | 1325 item->NotifyTransaction(result, entry); |
| 1327 } | 1326 } |
| 1328 } | 1327 } |
| 1329 } | 1328 } |
| 1330 } | 1329 } |
| 1331 | 1330 |
| 1332 // static | 1331 // static |
| 1333 void HttpCache::OnPendingOpComplete(const base::WeakPtr<HttpCache>& cache, | 1332 void HttpCache::OnPendingOpComplete(const base::WeakPtr<HttpCache>& cache, |
| 1334 PendingOp* pending_op, | 1333 PendingOp* pending_op, |
| 1335 int rv) { | 1334 int rv) { |
| 1336 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | |
| 1337 tracked_objects::ScopedTracker tracking_profile( | |
| 1338 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 1339 "422516 HttpCache::OnPendingOpComplete")); | |
| 1340 | |
| 1341 if (cache.get()) { | 1335 if (cache.get()) { |
| 1342 cache->OnIOComplete(rv, pending_op); | 1336 cache->OnIOComplete(rv, pending_op); |
| 1343 } else { | 1337 } else { |
| 1344 // The callback was cancelled so we should delete the pending_op that | 1338 // The callback was cancelled so we should delete the pending_op that |
| 1345 // was used with this callback. | 1339 // was used with this callback. |
| 1346 delete pending_op; | 1340 delete pending_op; |
| 1347 } | 1341 } |
| 1348 } | 1342 } |
| 1349 | 1343 |
| 1350 void HttpCache::OnBackendCreated(int result, PendingOp* pending_op) { | 1344 void HttpCache::OnBackendCreated(int result, PendingOp* pending_op) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 building_backend_ = false; | 1378 building_backend_ = false; |
| 1385 DeletePendingOp(pending_op); | 1379 DeletePendingOp(pending_op); |
| 1386 } | 1380 } |
| 1387 | 1381 |
| 1388 // The cache may be gone when we return from the callback. | 1382 // The cache may be gone when we return from the callback. |
| 1389 if (!item->DoCallback(result, disk_cache_.get())) | 1383 if (!item->DoCallback(result, disk_cache_.get())) |
| 1390 item->NotifyTransaction(result, NULL); | 1384 item->NotifyTransaction(result, NULL); |
| 1391 } | 1385 } |
| 1392 | 1386 |
| 1393 } // namespace net | 1387 } // namespace net |
| OLD | NEW |