| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/blob/blob_storage_controller.h" | 5 #include "webkit/blob/blob_storage_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "net/base/upload_data.h" | 9 #include "net/base/upload_data.h" |
| 10 #include "webkit/blob/blob_data.h" | 10 #include "webkit/blob/blob_data.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 const webkit_blob::BlobData::Item& item = blob_data->items().at(i - 1); | 122 const webkit_blob::BlobData::Item& item = blob_data->items().at(i - 1); |
| 123 switch (item.type()) { | 123 switch (item.type()) { |
| 124 case webkit_blob::BlobData::TYPE_DATA: | 124 case webkit_blob::BlobData::TYPE_DATA: |
| 125 // TODO(jianli): Figure out how to avoid copying the data. | 125 // TODO(jianli): Figure out how to avoid copying the data. |
| 126 iter->SetToBytes( | 126 iter->SetToBytes( |
| 127 &item.data().at(0) + static_cast<int>(item.offset()), | 127 &item.data().at(0) + static_cast<int>(item.offset()), |
| 128 static_cast<int>(item.length())); | 128 static_cast<int>(item.length())); |
| 129 break; | 129 break; |
| 130 case webkit_blob::BlobData::TYPE_FILE: | 130 case webkit_blob::BlobData::TYPE_FILE: |
| 131 // TODO(michaeln): Ensure that any temp files survive till the | 131 // TODO(michaeln): Ensure that any temp files survive till the |
| 132 // URLRequest is done with the upload. | 132 // net::URLRequest is done with the upload. |
| 133 iter->SetToFilePathRange( | 133 iter->SetToFilePathRange( |
| 134 item.file_path(), | 134 item.file_path(), |
| 135 item.offset(), | 135 item.offset(), |
| 136 item.length(), | 136 item.length(), |
| 137 item.expected_modification_time()); | 137 item.expected_modification_time()); |
| 138 break; | 138 break; |
| 139 default: | 139 default: |
| 140 NOTREACHED(); | 140 NOTREACHED(); |
| 141 break; | 141 break; |
| 142 } | 142 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 expected_modification_time); | 189 expected_modification_time); |
| 190 | 190 |
| 191 // It may be a temporary file that should be deleted when no longer needed. | 191 // It may be a temporary file that should be deleted when no longer needed. |
| 192 scoped_refptr<DeletableFileReference> deletable_file = | 192 scoped_refptr<DeletableFileReference> deletable_file = |
| 193 DeletableFileReference::Get(file_path); | 193 DeletableFileReference::Get(file_path); |
| 194 if (deletable_file) | 194 if (deletable_file) |
| 195 target_blob_data->AttachDeletableFileReference(deletable_file); | 195 target_blob_data->AttachDeletableFileReference(deletable_file); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace webkit_blob | 198 } // namespace webkit_blob |
| OLD | NEW |