Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: Source/core/fileapi/Blob.h

Issue 1118993002: Oilpan: IDL union objects should be put in HeapVector (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/modules/UnionTypesModules.h ('k') | Source/core/fileapi/Blob.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class ExecutionContext; 50 class ExecutionContext;
51 51
52 class CORE_EXPORT Blob : public GarbageCollectedFinalized<Blob>, public ScriptWr appable, public URLRegistrable { 52 class CORE_EXPORT Blob : public GarbageCollectedFinalized<Blob>, public ScriptWr appable, public URLRegistrable {
53 DEFINE_WRAPPERTYPEINFO(); 53 DEFINE_WRAPPERTYPEINFO();
54 public: 54 public:
55 static Blob* create(ExceptionState&) 55 static Blob* create(ExceptionState&)
56 { 56 {
57 return new Blob(BlobDataHandle::create()); 57 return new Blob(BlobDataHandle::create());
58 } 58 }
59 59
60 static Blob* create(const Vector<ArrayBufferOrArrayBufferViewOrBlobOrString> &, const BlobPropertyBag&, ExceptionState&); 60 static Blob* create(const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrStr ing>&, const BlobPropertyBag&, ExceptionState&);
61 61
62 static Blob* create(PassRefPtr<BlobDataHandle> blobDataHandle) 62 static Blob* create(PassRefPtr<BlobDataHandle> blobDataHandle)
63 { 63 {
64 return new Blob(blobDataHandle); 64 return new Blob(blobDataHandle);
65 } 65 }
66 66
67 virtual ~Blob(); 67 virtual ~Blob();
68 68
69 virtual unsigned long long size() const { return m_blobDataHandle->size(); } 69 virtual unsigned long long size() const { return m_blobDataHandle->size(); }
70 virtual Blob* slice(long long start, long long end, const String& contentTyp e, ExceptionState&) const; 70 virtual Blob* slice(long long start, long long end, const String& contentTyp e, ExceptionState&) const;
(...skipping 28 matching lines...) Expand all
99 99
100 // URLRegistrable to support PublicURLs. 100 // URLRegistrable to support PublicURLs.
101 virtual URLRegistry& registry() const override final; 101 virtual URLRegistry& registry() const override final;
102 102
103 DEFINE_INLINE_TRACE() { } 103 DEFINE_INLINE_TRACE() { }
104 104
105 protected: 105 protected:
106 explicit Blob(PassRefPtr<BlobDataHandle>); 106 explicit Blob(PassRefPtr<BlobDataHandle>);
107 107
108 template<typename ItemType> 108 template<typename ItemType>
109 static void populateBlobData(BlobData* blobData, const Vector<ItemType>& par ts, bool normalizeLineEndingsToNative) 109 static void populateBlobData(BlobData* blobData, const HeapVector<ItemType>& parts, bool normalizeLineEndingsToNative)
110 { 110 {
111 for (size_t i = 0; i < parts.size(); ++i) { 111 for (size_t i = 0; i < parts.size(); ++i) {
112 const ItemType& item = parts[i]; 112 const ItemType& item = parts[i];
113 if (item.isArrayBuffer()) { 113 if (item.isArrayBuffer()) {
114 RefPtr<DOMArrayBuffer> arrayBuffer = item.getAsArrayBuffer(); 114 RefPtr<DOMArrayBuffer> arrayBuffer = item.getAsArrayBuffer();
115 blobData->appendBytes(arrayBuffer->data(), arrayBuffer->byteLeng th()); 115 blobData->appendBytes(arrayBuffer->data(), arrayBuffer->byteLeng th());
116 } else if (item.isArrayBufferView()) { 116 } else if (item.isArrayBufferView()) {
117 RefPtr<DOMArrayBufferView> arrayBufferView = item.getAsArrayBuff erView(); 117 RefPtr<DOMArrayBufferView> arrayBufferView = item.getAsArrayBuff erView();
118 blobData->appendBytes(arrayBufferView->baseAddress(), arrayBuffe rView->byteLength()); 118 blobData->appendBytes(arrayBufferView->baseAddress(), arrayBuffe rView->byteLength());
119 } else if (item.isBlob()) { 119 } else if (item.isBlob()) {
(...skipping 10 matching lines...) Expand all
130 private: 130 private:
131 Blob(); 131 Blob();
132 132
133 RefPtr<BlobDataHandle> m_blobDataHandle; 133 RefPtr<BlobDataHandle> m_blobDataHandle;
134 bool m_hasBeenClosed; 134 bool m_hasBeenClosed;
135 }; 135 };
136 136
137 } // namespace blink 137 } // namespace blink
138 138
139 #endif // Blob_h 139 #endif // Blob_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/modules/UnionTypesModules.h ('k') | Source/core/fileapi/Blob.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698