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_disk_cache.h" | 5 #include "content/browser/appcache/appcache_disk_cache.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
17 #include "net/base/cache_type.h" | 18 #include "net/base/cache_type.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 create_backend_callback_)); | 363 create_backend_callback_)); |
363 if (rv == net::ERR_IO_PENDING) | 364 if (rv == net::ERR_IO_PENDING) |
364 init_callback_ = callback; | 365 init_callback_ = callback; |
365 else | 366 else |
366 OnCreateBackendComplete(rv); | 367 OnCreateBackendComplete(rv); |
367 return rv; | 368 return rv; |
368 } | 369 } |
369 | 370 |
370 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { | 371 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { |
371 if (rv == net::OK) { | 372 if (rv == net::OK) { |
372 disk_cache_ = create_backend_callback_->backend_ptr_.Pass(); | 373 disk_cache_ = std::move(create_backend_callback_->backend_ptr_); |
373 } | 374 } |
374 create_backend_callback_ = NULL; | 375 create_backend_callback_ = NULL; |
375 | 376 |
376 // Invoke our clients callback function. | 377 // Invoke our clients callback function. |
377 if (!init_callback_.is_null()) { | 378 if (!init_callback_.is_null()) { |
378 init_callback_.Run(rv); | 379 init_callback_.Run(rv); |
379 init_callback_.Reset(); | 380 init_callback_.Reset(); |
380 } | 381 } |
381 | 382 |
382 // Service pending calls that were queued up while we were initializing. | 383 // Service pending calls that were queued up while we were initializing. |
(...skipping 14 matching lines...) Expand all Loading... |
397 NOTREACHED(); | 398 NOTREACHED(); |
398 break; | 399 break; |
399 } | 400 } |
400 if (rv != net::ERR_IO_PENDING) | 401 if (rv != net::ERR_IO_PENDING) |
401 iter->callback.Run(rv); | 402 iter->callback.Run(rv); |
402 } | 403 } |
403 pending_calls_.clear(); | 404 pending_calls_.clear(); |
404 } | 405 } |
405 | 406 |
406 } // namespace content | 407 } // namespace content |
OLD | NEW |