OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "public/web/WebBlob.h" | 31 #include "public/web/WebBlob.h" |
32 | 32 |
33 #include "bindings/core/v8/V8Binding.h" | 33 #include "bindings/core/v8/V8Binding.h" |
34 #include "bindings/core/v8/V8Blob.h" | 34 #include "bindings/core/v8/V8Blob.h" |
35 #include "core/fileapi/Blob.h" | 35 #include "core/fileapi/Blob.h" |
36 #include "platform/FileMetadata.h" | 36 #include "platform/FileMetadata.h" |
37 #include "platform/blob/BlobData.h" | 37 #include "platform/blob/BlobData.h" |
38 #include "wtf/PassOwnPtr.h" | 38 #include <memory> |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 WebBlob WebBlob::createFromUUID(const WebString& uuid, const WebString& type, lo
ng long size) | 42 WebBlob WebBlob::createFromUUID(const WebString& uuid, const WebString& type, lo
ng long size) |
43 { | 43 { |
44 return Blob::create(BlobDataHandle::create(uuid, type, size)); | 44 return Blob::create(BlobDataHandle::create(uuid, type, size)); |
45 } | 45 } |
46 | 46 |
47 WebBlob WebBlob::createFromFile(const WebString& path, long long size) | 47 WebBlob WebBlob::createFromFile(const WebString& path, long long size) |
48 { | 48 { |
49 OwnPtr<BlobData> blobData = BlobData::create(); | 49 std::unique_ptr<BlobData> blobData = BlobData::create(); |
50 blobData->appendFile(path, 0, size, invalidFileTime()); | 50 blobData->appendFile(path, 0, size, invalidFileTime()); |
51 return Blob::create(BlobDataHandle::create(std::move(blobData), size)); | 51 return Blob::create(BlobDataHandle::create(std::move(blobData), size)); |
52 } | 52 } |
53 | 53 |
54 WebBlob WebBlob::fromV8Value(v8::Local<v8::Value> value) | 54 WebBlob WebBlob::fromV8Value(v8::Local<v8::Value> value) |
55 { | 55 { |
56 if (V8Blob::hasInstance(value, v8::Isolate::GetCurrent())) { | 56 if (V8Blob::hasInstance(value, v8::Isolate::GetCurrent())) { |
57 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 57 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
58 Blob* blob = V8Blob::toImpl(object); | 58 Blob* blob = V8Blob::toImpl(object); |
59 DCHECK(blob); | 59 DCHECK(blob); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 { | 94 { |
95 } | 95 } |
96 | 96 |
97 WebBlob& WebBlob::operator=(Blob* blob) | 97 WebBlob& WebBlob::operator=(Blob* blob) |
98 { | 98 { |
99 m_private = blob; | 99 m_private = blob; |
100 return *this; | 100 return *this; |
101 } | 101 } |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
OLD | NEW |