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/storage_partition_impl_map.h" | 5 #include "content/browser/storage_partition_impl_map.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 // Note: moving this into Get() before partitions_[] is set causes reentrency. | 583 // Note: moving this into Get() before partitions_[] is set causes reentrency. |
584 if (!resource_context_initialized_) { | 584 if (!resource_context_initialized_) { |
585 resource_context_initialized_ = true; | 585 resource_context_initialized_ = true; |
586 InitializeResourceContext(browser_context_); | 586 InitializeResourceContext(browser_context_); |
587 } | 587 } |
588 | 588 |
589 // Check first to avoid memory leak in unittests. | 589 // Check first to avoid memory leak in unittests. |
590 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 590 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
591 BrowserThread::PostTask( | 591 BrowserThread::PostTask( |
592 BrowserThread::IO, FROM_HERE, | 592 BrowserThread::IO, FROM_HERE, |
593 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 593 base::Bind( |
594 partition->GetAppCacheService(), | 594 &ChromeAppCacheService::InitializeOnIOThread, |
595 in_memory ? base::FilePath() : | 595 partition->GetAppCacheService(), |
596 partition->GetPath().Append(kAppCacheDirname), | 596 in_memory ? base::FilePath() |
597 browser_context_->GetResourceContext(), | 597 : partition->GetPath().Append(kAppCacheDirname), |
598 make_scoped_refptr(partition->GetURLRequestContext()), | 598 browser_context_->GetResourceContext(), |
599 make_scoped_refptr( | 599 base::RetainedRef(partition->GetURLRequestContext()), |
600 browser_context_->GetSpecialStoragePolicy()))); | 600 base::RetainedRef(browser_context_->GetSpecialStoragePolicy()))); |
601 | 601 |
602 BrowserThread::PostTask( | 602 BrowserThread::PostTask( |
603 BrowserThread::IO, FROM_HERE, | 603 BrowserThread::IO, FROM_HERE, |
604 base::Bind(&CacheStorageContextImpl::SetBlobParametersForCache, | 604 base::Bind(&CacheStorageContextImpl::SetBlobParametersForCache, |
605 partition->GetCacheStorageContext(), | 605 partition->GetCacheStorageContext(), |
606 make_scoped_refptr(partition->GetURLRequestContext()), | 606 base::RetainedRef(partition->GetURLRequestContext()), |
607 make_scoped_refptr( | 607 base::RetainedRef( |
608 ChromeBlobStorageContext::GetFor(browser_context_)))); | 608 ChromeBlobStorageContext::GetFor(browser_context_)))); |
609 | 609 |
610 BrowserThread::PostTask( | 610 BrowserThread::PostTask( |
611 BrowserThread::IO, FROM_HERE, | 611 BrowserThread::IO, FROM_HERE, |
612 base::Bind(&ServiceWorkerContextWrapper::InitializeResourceContext, | 612 base::Bind(&ServiceWorkerContextWrapper::InitializeResourceContext, |
613 partition->GetServiceWorkerContext(), | 613 partition->GetServiceWorkerContext(), |
614 browser_context_->GetResourceContext(), | 614 browser_context_->GetResourceContext(), |
615 make_scoped_refptr(partition->GetURLRequestContext()))); | 615 base::RetainedRef(partition->GetURLRequestContext()))); |
616 | 616 |
617 // We do not call InitializeURLRequestContext() for media contexts because, | 617 // We do not call InitializeURLRequestContext() for media contexts because, |
618 // other than the HTTP cache, the media contexts share the same backing | 618 // other than the HTTP cache, the media contexts share the same backing |
619 // objects as their associated "normal" request context. Thus, the previous | 619 // objects as their associated "normal" request context. Thus, the previous |
620 // call serves to initialize the media request context for this storage | 620 // call serves to initialize the media request context for this storage |
621 // partition as well. | 621 // partition as well. |
622 } | 622 } |
623 } | 623 } |
624 | 624 |
625 } // namespace content | 625 } // namespace content |
OLD | NEW |