OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/child/blob_storage/blob_transport_controller.h" | 5 #include "content/child/blob_storage/blob_transport_controller.h" |
6 | 6 |
| 7 #include <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
10 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
11 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
13 #include "content/child/blob_storage/blob_consolidation.h" | 14 #include "content/child/blob_storage/blob_consolidation.h" |
14 #include "content/child/thread_safe_sender.h" | 15 #include "content/child/thread_safe_sender.h" |
15 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
16 #include "storage/common/blob_storage/blob_item_bytes_request.h" | 17 #include "storage/common/blob_storage/blob_item_bytes_request.h" |
(...skipping 25 matching lines...) Expand all Loading... |
42 } | 43 } |
43 | 44 |
44 BlobTransportController::~BlobTransportController() {} | 45 BlobTransportController::~BlobTransportController() {} |
45 | 46 |
46 void BlobTransportController::InitiateBlobTransfer( | 47 void BlobTransportController::InitiateBlobTransfer( |
47 const std::string& uuid, | 48 const std::string& uuid, |
48 const std::string& type, | 49 const std::string& type, |
49 scoped_ptr<BlobConsolidation> consolidation, | 50 scoped_ptr<BlobConsolidation> consolidation, |
50 IPC::Sender* sender) { | 51 IPC::Sender* sender) { |
51 BlobConsolidation* consolidation_ptr = consolidation.get(); | 52 BlobConsolidation* consolidation_ptr = consolidation.get(); |
52 blob_storage_.insert(std::make_pair(uuid, consolidation.Pass())); | 53 blob_storage_.insert(std::make_pair(uuid, std::move(consolidation))); |
53 std::vector<storage::DataElement> descriptions; | 54 std::vector<storage::DataElement> descriptions; |
54 GetDescriptions(consolidation_ptr, kLargeThresholdBytes, &descriptions); | 55 GetDescriptions(consolidation_ptr, kLargeThresholdBytes, &descriptions); |
55 // TODO(dmurph): Uncomment when IPC messages are added. | 56 // TODO(dmurph): Uncomment when IPC messages are added. |
56 // sender->Send(new BlobStorageMsg_StartBuildingBlob(uuid, type, | 57 // sender->Send(new BlobStorageMsg_StartBuildingBlob(uuid, type, |
57 // descriptions)); | 58 // descriptions)); |
58 } | 59 } |
59 | 60 |
60 void BlobTransportController::OnMemoryRequest( | 61 void BlobTransportController::OnMemoryRequest( |
61 const std::string& uuid, | 62 const std::string& uuid, |
62 const std::vector<storage::BlobItemBytesRequest>& requests, | 63 const std::vector<storage::BlobItemBytesRequest>& requests, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 252 } |
252 return ResponsesStatus::SUCCESS; | 253 return ResponsesStatus::SUCCESS; |
253 } | 254 } |
254 | 255 |
255 void BlobTransportController::ReleaseBlobConsolidation( | 256 void BlobTransportController::ReleaseBlobConsolidation( |
256 const std::string& uuid) { | 257 const std::string& uuid) { |
257 blob_storage_.erase(uuid); | 258 blob_storage_.erase(uuid); |
258 } | 259 } |
259 | 260 |
260 } // namespace content | 261 } // namespace content |
OLD | NEW |