OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/glue/resource_request_body.h" | 5 #include "webkit/glue/resource_request_body.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/base/upload_bytes_element_reader.h" | 8 #include "net/base/upload_bytes_element_reader.h" |
9 #include "net/base/upload_data_stream.h" | 9 #include "net/base/upload_data_stream.h" |
10 #include "net/base/upload_file_element_reader.h" | 10 #include "net/base/upload_file_element_reader.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 ResourceRequestBody::~ResourceRequestBody() {} | 146 ResourceRequestBody::~ResourceRequestBody() {} |
147 | 147 |
148 void ResourceRequestBody::ResolveBlobReference( | 148 void ResourceRequestBody::ResolveBlobReference( |
149 webkit_blob::BlobStorageController* blob_controller, | 149 webkit_blob::BlobStorageController* blob_controller, |
150 const GURL& blob_url, | 150 const GURL& blob_url, |
151 std::vector<const Element*>* resolved_elements) { | 151 std::vector<const Element*>* resolved_elements) { |
152 DCHECK(blob_controller); | 152 DCHECK(blob_controller); |
153 BlobData* blob_data = blob_controller->GetBlobDataFromUrl(blob_url); | 153 BlobData* blob_data = blob_controller->GetBlobDataFromUrl(blob_url); |
154 DCHECK(blob_data); | |
155 if (!blob_data) | 154 if (!blob_data) |
156 return; | 155 return; |
157 | 156 |
158 // If there is no element in the referred blob data, just return. | 157 // If there is no element in the referred blob data, just return. |
159 if (blob_data->items().empty()) | 158 if (blob_data->items().empty()) |
160 return; | 159 return; |
161 | 160 |
162 // Ensure the blob and any attached shareable files survive until | 161 // Ensure the blob and any attached shareable files survive until |
163 // upload completion. | 162 // upload completion. |
164 SetUserData(blob_data, new base::UserDataAdapter<BlobData>(blob_data)); | 163 SetUserData(blob_data, new base::UserDataAdapter<BlobData>(blob_data)); |
165 | 164 |
166 // Append the elements in the referred blob data. | 165 // Append the elements in the referred blob data. |
167 for (size_t i = 0; i < blob_data->items().size(); ++i) { | 166 for (size_t i = 0; i < blob_data->items().size(); ++i) { |
168 const BlobData::Item& item = blob_data->items().at(i); | 167 const BlobData::Item& item = blob_data->items().at(i); |
169 DCHECK_NE(BlobData::Item::TYPE_BLOB, item.type()); | 168 DCHECK_NE(BlobData::Item::TYPE_BLOB, item.type()); |
170 resolved_elements->push_back(&item); | 169 resolved_elements->push_back(&item); |
171 } | 170 } |
172 } | 171 } |
173 | 172 |
174 } // namespace webkit_glue | 173 } // namespace webkit_glue |
OLD | NEW |