| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/service_worker/service_worker_cache.h" | 5 #include "content/browser/service_worker/service_worker_cache.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 return; | 558 return; |
| 559 } | 559 } |
| 560 cache->set_backend(backend_ptr->Pass()); | 560 cache->set_backend(backend_ptr->Pass()); |
| 561 callback.Run(ServiceWorkerCache::ErrorTypeOK); | 561 callback.Run(ServiceWorkerCache::ErrorTypeOK); |
| 562 } | 562 } |
| 563 | 563 |
| 564 } // namespace | 564 } // namespace |
| 565 | 565 |
| 566 // static | 566 // static |
| 567 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache( | 567 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache( |
| 568 const std::string& name, | |
| 569 net::URLRequestContext* request_context, | 568 net::URLRequestContext* request_context, |
| 570 base::WeakPtr<storage::BlobStorageContext> blob_context) { | 569 base::WeakPtr<storage::BlobStorageContext> blob_context) { |
| 571 return make_scoped_ptr(new ServiceWorkerCache( | 570 return make_scoped_ptr( |
| 572 base::FilePath(), name, request_context, blob_context)); | 571 new ServiceWorkerCache(base::FilePath(), request_context, blob_context)); |
| 573 } | 572 } |
| 574 | 573 |
| 575 // static | 574 // static |
| 576 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache( | 575 scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache( |
| 577 const base::FilePath& path, | 576 const base::FilePath& path, |
| 578 const std::string& name, | |
| 579 net::URLRequestContext* request_context, | 577 net::URLRequestContext* request_context, |
| 580 base::WeakPtr<storage::BlobStorageContext> blob_context) { | 578 base::WeakPtr<storage::BlobStorageContext> blob_context) { |
| 581 return make_scoped_ptr( | 579 return make_scoped_ptr( |
| 582 new ServiceWorkerCache(path, name, request_context, blob_context)); | 580 new ServiceWorkerCache(path, request_context, blob_context)); |
| 583 } | 581 } |
| 584 | 582 |
| 585 ServiceWorkerCache::~ServiceWorkerCache() { | 583 ServiceWorkerCache::~ServiceWorkerCache() { |
| 586 } | 584 } |
| 587 | 585 |
| 588 base::WeakPtr<ServiceWorkerCache> ServiceWorkerCache::AsWeakPtr() { | 586 base::WeakPtr<ServiceWorkerCache> ServiceWorkerCache::AsWeakPtr() { |
| 589 return weak_ptr_factory_.GetWeakPtr(); | 587 return weak_ptr_factory_.GetWeakPtr(); |
| 590 } | 588 } |
| 591 | 589 |
| 592 void ServiceWorkerCache::CreateBackend(const ErrorCallback& callback) { | 590 void ServiceWorkerCache::CreateBackend(const ErrorCallback& callback) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 if (rv != net::ERR_IO_PENDING) | 700 if (rv != net::ERR_IO_PENDING) |
| 703 open_entry_callback.Run(rv); | 701 open_entry_callback.Run(rv); |
| 704 } | 702 } |
| 705 | 703 |
| 706 bool ServiceWorkerCache::HasCreatedBackend() const { | 704 bool ServiceWorkerCache::HasCreatedBackend() const { |
| 707 return backend_; | 705 return backend_; |
| 708 } | 706 } |
| 709 | 707 |
| 710 ServiceWorkerCache::ServiceWorkerCache( | 708 ServiceWorkerCache::ServiceWorkerCache( |
| 711 const base::FilePath& path, | 709 const base::FilePath& path, |
| 712 const std::string& name, | |
| 713 net::URLRequestContext* request_context, | 710 net::URLRequestContext* request_context, |
| 714 base::WeakPtr<storage::BlobStorageContext> blob_context) | 711 base::WeakPtr<storage::BlobStorageContext> blob_context) |
| 715 : path_(path), | 712 : path_(path), |
| 716 name_(name), | |
| 717 request_context_(request_context), | 713 request_context_(request_context), |
| 718 blob_storage_context_(blob_context), | 714 blob_storage_context_(blob_context), |
| 719 id_(0), | |
| 720 weak_ptr_factory_(this) { | 715 weak_ptr_factory_(this) { |
| 721 } | 716 } |
| 722 | 717 |
| 723 } // namespace content | 718 } // namespace content |
| OLD | NEW |