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" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop_proxy.h" | |
15 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
16 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/thread_task_runner_handle.h" | |
17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
18 #include "storage/browser/blob/blob_data_builder.h" | 18 #include "storage/browser/blob/blob_data_builder.h" |
19 #include "storage/browser/blob/blob_data_handle.h" | 19 #include "storage/browser/blob/blob_data_handle.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 namespace storage { | 22 namespace storage { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // We can't use GURL directly for these hash fragment manipulations | 26 // We can't use GURL directly for these hash fragment manipulations |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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( |
81 new BlobDataHandle(uuid, this, base::MessageLoopProxy::current().get())); | 81 new BlobDataHandle(uuid, this, |
82 base::ThreadTaskRunnerHandle::Get().get() | |
83 )); | |
kinuko
2015/04/30 12:44:49
Um, sorry I meant if we could have '));' on the sa
| |
82 return result.Pass(); | 84 return result.Pass(); |
83 } | 85 } |
84 | 86 |
85 scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromPublicURL( | 87 scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromPublicURL( |
86 const GURL& url) { | 88 const GURL& url) { |
87 BlobURLMap::iterator found = | 89 BlobURLMap::iterator found = |
88 public_blob_urls_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url); | 90 public_blob_urls_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url); |
89 if (found == public_blob_urls_.end()) | 91 if (found == public_blob_urls_.end()) |
90 return scoped_ptr<BlobDataHandle>(); | 92 return scoped_ptr<BlobDataHandle>(); |
91 return GetBlobDataFromUUID(found->second); | 93 return GetBlobDataFromUUID(found->second); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 if (found == blob_map_.end()) | 472 if (found == blob_map_.end()) |
471 return false; | 473 return false; |
472 return found->second->IsBeingBuilt(); | 474 return found->second->IsBeingBuilt(); |
473 } | 475 } |
474 | 476 |
475 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { | 477 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { |
476 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); | 478 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); |
477 } | 479 } |
478 | 480 |
479 } // namespace storage | 481 } // namespace storage |
OLD | NEW |