OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_url_request_job_factory.h" | 5 #include "storage/browser/blob/blob_url_request_job_factory.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 std::unique_ptr<net::URLRequest> request = request_context->CreateRequest( | 32 std::unique_ptr<net::URLRequest> request = request_context->CreateRequest( |
33 kBlobUrl, net::DEFAULT_PRIORITY, request_delegate); | 33 kBlobUrl, net::DEFAULT_PRIORITY, request_delegate); |
34 SetRequestedBlobDataHandle(request.get(), std::move(blob_data_handle)); | 34 SetRequestedBlobDataHandle(request.get(), std::move(blob_data_handle)); |
35 return request; | 35 return request; |
36 } | 36 } |
37 | 37 |
38 // static | 38 // static |
39 void BlobProtocolHandler::SetRequestedBlobDataHandle( | 39 void BlobProtocolHandler::SetRequestedBlobDataHandle( |
40 net::URLRequest* request, | 40 net::URLRequest* request, |
41 std::unique_ptr<BlobDataHandle> blob_data_handle) { | 41 std::unique_ptr<BlobDataHandle> blob_data_handle) { |
42 request->SetUserData(&kUserDataKey, blob_data_handle.release()); | 42 request->SetUserData(&kUserDataKey, std::move(blob_data_handle)); |
43 } | 43 } |
44 | 44 |
45 // static | 45 // static |
46 BlobDataHandle* BlobProtocolHandler::GetRequestBlobDataHandle( | 46 BlobDataHandle* BlobProtocolHandler::GetRequestBlobDataHandle( |
47 net::URLRequest* request) { | 47 net::URLRequest* request) { |
48 return static_cast<BlobDataHandle*>(request->GetUserData(&kUserDataKey)); | 48 return static_cast<BlobDataHandle*>(request->GetUserData(&kUserDataKey)); |
49 } | 49 } |
50 | 50 |
51 BlobProtocolHandler::BlobProtocolHandler( | 51 BlobProtocolHandler::BlobProtocolHandler( |
52 BlobStorageContext* context, | 52 BlobStorageContext* context, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 std::string uuid = request->url().spec().substr(kPrefix.length()); | 86 std::string uuid = request->url().spec().substr(kPrefix.length()); |
87 std::unique_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); | 87 std::unique_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); |
88 BlobDataHandle* handle_ptr = handle.get(); | 88 BlobDataHandle* handle_ptr = handle.get(); |
89 if (handle) { | 89 if (handle) { |
90 SetRequestedBlobDataHandle(request, std::move(handle)); | 90 SetRequestedBlobDataHandle(request, std::move(handle)); |
91 } | 91 } |
92 return handle_ptr; | 92 return handle_ptr; |
93 } | 93 } |
94 | 94 |
95 } // namespace storage | 95 } // namespace storage |
OLD | NEW |