| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "platform/blob/BlobData.h" | 34 #include "platform/blob/BlobData.h" |
| 35 #include <memory> | 35 #include <memory> |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 WebBlobData::WebBlobData() {} | 39 WebBlobData::WebBlobData() {} |
| 40 | 40 |
| 41 WebBlobData::~WebBlobData() {} | 41 WebBlobData::~WebBlobData() {} |
| 42 | 42 |
| 43 size_t WebBlobData::ItemCount() const { | 43 size_t WebBlobData::ItemCount() const { |
| 44 ASSERT(!IsNull()); | 44 DCHECK(!IsNull()); |
| 45 return private_->Items().size(); | 45 return private_->Items().size(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool WebBlobData::ItemAt(size_t index, Item& result) const { | 48 bool WebBlobData::ItemAt(size_t index, Item& result) const { |
| 49 ASSERT(!IsNull()); | 49 DCHECK(!IsNull()); |
| 50 | 50 |
| 51 if (index >= private_->Items().size()) | 51 if (index >= private_->Items().size()) |
| 52 return false; | 52 return false; |
| 53 | 53 |
| 54 const BlobDataItem& item = private_->Items()[index]; | 54 const BlobDataItem& item = private_->Items()[index]; |
| 55 result.data.Reset(); | 55 result.data.Reset(); |
| 56 result.file_path.Reset(); | 56 result.file_path.Reset(); |
| 57 result.blob_uuid.Reset(); | 57 result.blob_uuid.Reset(); |
| 58 result.offset = item.offset; | 58 result.offset = item.offset; |
| 59 result.length = item.length; | 59 result.length = item.length; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 70 return true; | 70 return true; |
| 71 case BlobDataItem::kBlob: | 71 case BlobDataItem::kBlob: |
| 72 result.type = Item::kTypeBlob; | 72 result.type = Item::kTypeBlob; |
| 73 result.blob_uuid = item.blob_data_handle->Uuid(); | 73 result.blob_uuid = item.blob_data_handle->Uuid(); |
| 74 return true; | 74 return true; |
| 75 case BlobDataItem::kFileSystemURL: | 75 case BlobDataItem::kFileSystemURL: |
| 76 result.type = Item::kTypeFileSystemURL; | 76 result.type = Item::kTypeFileSystemURL; |
| 77 result.file_system_url = item.file_system_url; | 77 result.file_system_url = item.file_system_url; |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| 80 ASSERT_NOT_REACHED(); | 80 NOTREACHED(); |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 WebString WebBlobData::ContentType() const { | 84 WebString WebBlobData::ContentType() const { |
| 85 ASSERT(!IsNull()); | 85 DCHECK(!IsNull()); |
| 86 return private_->ContentType(); | 86 return private_->ContentType(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 WebBlobData::WebBlobData(std::unique_ptr<BlobData> data) | 89 WebBlobData::WebBlobData(std::unique_ptr<BlobData> data) |
| 90 : private_(std::move(data)) {} | 90 : private_(std::move(data)) {} |
| 91 | 91 |
| 92 WebBlobData& WebBlobData::operator=(std::unique_ptr<BlobData> data) { | 92 WebBlobData& WebBlobData::operator=(std::unique_ptr<BlobData> data) { |
| 93 private_ = std::move(data); | 93 private_ = std::move(data); |
| 94 return *this; | 94 return *this; |
| 95 } | 95 } |
| 96 | 96 |
| 97 WebBlobData::operator std::unique_ptr<BlobData>() { | 97 WebBlobData::operator std::unique_ptr<BlobData>() { |
| 98 return std::move(private_); | 98 return std::move(private_); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace blink | 101 } // namespace blink |
| OLD | NEW |