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/fileapi/blob_storage_host.h" | 5 #include "content/browser/fileapi/blob_storage_host.h" |
6 | 6 |
7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "storage/browser/blob/blob_data_handle.h" | |
10 #include "storage/browser/blob/blob_storage_context.h" | 9 #include "storage/browser/blob/blob_storage_context.h" |
11 #include "url/gurl.h" | 10 #include "url/gurl.h" |
12 | 11 |
13 using storage::BlobStorageContext; | 12 using storage::BlobStorageContext; |
14 using storage::BlobData; | 13 using storage::BlobDataBuilder; |
michaeln
2015/01/16 00:09:09
needed?
dmurph
2015/01/16 23:45:56
Done.
| |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 | 16 |
18 BlobStorageHost::BlobStorageHost(BlobStorageContext* context) | 17 BlobStorageHost::BlobStorageHost(BlobStorageContext* context) |
19 : context_(context->AsWeakPtr()) { | 18 : context_(context->AsWeakPtr()) { |
20 } | 19 } |
21 | 20 |
22 BlobStorageHost::~BlobStorageHost() { | 21 BlobStorageHost::~BlobStorageHost() { |
23 if (!context_.get()) | 22 if (!context_.get()) |
24 return; | 23 return; |
(...skipping 10 matching lines...) Expand all Loading... | |
35 | 34 |
36 bool BlobStorageHost::StartBuildingBlob(const std::string& uuid) { | 35 bool BlobStorageHost::StartBuildingBlob(const std::string& uuid) { |
37 if (!context_.get() || uuid.empty() || context_->IsInUse(uuid)) | 36 if (!context_.get() || uuid.empty() || context_->IsInUse(uuid)) |
38 return false; | 37 return false; |
39 context_->StartBuildingBlob(uuid); | 38 context_->StartBuildingBlob(uuid); |
40 blobs_inuse_map_[uuid] = 1; | 39 blobs_inuse_map_[uuid] = 1; |
41 return true; | 40 return true; |
42 } | 41 } |
43 | 42 |
44 bool BlobStorageHost::AppendBlobDataItem( | 43 bool BlobStorageHost::AppendBlobDataItem( |
45 const std::string& uuid, const BlobData::Item& data_item) { | 44 const std::string& uuid, |
45 const storage::DataElement& data_item) { | |
46 if (!context_.get() || !IsBeingBuiltInHost(uuid)) | 46 if (!context_.get() || !IsBeingBuiltInHost(uuid)) |
47 return false; | 47 return false; |
48 context_->AppendBlobDataItem(uuid, data_item); | 48 context_->AppendBlobDataItem(uuid, data_item); |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 bool BlobStorageHost::CancelBuildingBlob(const std::string& uuid) { | 52 bool BlobStorageHost::CancelBuildingBlob(const std::string& uuid) { |
53 if (!context_.get() || !IsBeingBuiltInHost(uuid)) | 53 if (!context_.get() || !IsBeingBuiltInHost(uuid)) |
54 return false; | 54 return false; |
55 blobs_inuse_map_.erase(uuid); | 55 blobs_inuse_map_.erase(uuid); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 | 108 |
109 bool BlobStorageHost::IsBeingBuiltInHost(const std::string& uuid) { | 109 bool BlobStorageHost::IsBeingBuiltInHost(const std::string& uuid) { |
110 return IsInUseInHost(uuid) && context_->IsBeingBuilt(uuid); | 110 return IsInUseInHost(uuid) && context_->IsBeingBuilt(uuid); |
111 } | 111 } |
112 | 112 |
113 bool BlobStorageHost::IsUrlRegisteredInHost(const GURL& blob_url) { | 113 bool BlobStorageHost::IsUrlRegisteredInHost(const GURL& blob_url) { |
114 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); | 114 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); |
115 } | 115 } |
116 | 116 |
117 } // namespace content | 117 } // namespace content |
OLD | NEW |