| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "storage/browser/blob/blob_storage_context.h" | 5 #include "storage/browser/blob/blob_storage_context.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromUUID( | 70 scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromUUID( |
| 71 const std::string& uuid) { | 71 const std::string& uuid) { |
| 72 scoped_ptr<BlobDataHandle> result; | 72 scoped_ptr<BlobDataHandle> result; |
| 73 BlobMap::iterator found = blob_map_.find(uuid); | 73 BlobMap::iterator found = blob_map_.find(uuid); |
| 74 if (found == blob_map_.end()) | 74 if (found == blob_map_.end()) |
| 75 return result.Pass(); | 75 return result.Pass(); |
| 76 auto* entry = found->second; | 76 auto* entry = found->second; |
| 77 if (entry->flags & EXCEEDED_MEMORY) | 77 if (entry->flags & EXCEEDED_MEMORY) |
| 78 return result.Pass(); | 78 return result.Pass(); |
| 79 DCHECK(!entry->IsBeingBuilt()); | 79 DCHECK(!entry->IsBeingBuilt()); |
| 80 result.reset( | 80 result.reset(new BlobDataHandle(uuid, entry->data->content_type(), |
| 81 new BlobDataHandle(uuid, this, | 81 entry->data->content_disposition(), this, |
| 82 base::ThreadTaskRunnerHandle::Get().get())); | 82 base::ThreadTaskRunnerHandle::Get().get())); |
| 83 return result.Pass(); | 83 return result.Pass(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromPublicURL( | 86 scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromPublicURL( |
| 87 const GURL& url) { | 87 const GURL& url) { |
| 88 BlobURLMap::iterator found = | 88 BlobURLMap::iterator found = |
| 89 public_blob_urls_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url); | 89 public_blob_urls_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url); |
| 90 if (found == public_blob_urls_.end()) | 90 if (found == public_blob_urls_.end()) |
| 91 return scoped_ptr<BlobDataHandle>(); | 91 return scoped_ptr<BlobDataHandle>(); |
| 92 return GetBlobDataFromUUID(found->second); | 92 return GetBlobDataFromUUID(found->second); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 if (found == blob_map_.end()) | 491 if (found == blob_map_.end()) |
| 492 return false; | 492 return false; |
| 493 return found->second->IsBeingBuilt(); | 493 return found->second->IsBeingBuilt(); |
| 494 } | 494 } |
| 495 | 495 |
| 496 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { | 496 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { |
| 497 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); | 497 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 } // namespace storage | 500 } // namespace storage |
| OLD | NEW |