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

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

Issue 176853004: Oilpan: move core/fileapi to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 "config.h" 31 #include "config.h"
32 #include "core/fileapi/Blob.h" 32 #include "core/fileapi/Blob.h"
33 33
34 #include "core/fileapi/File.h"
34 #include "platform/blob/BlobRegistry.h" 35 #include "platform/blob/BlobRegistry.h"
35 #include "platform/blob/BlobURL.h" 36 #include "platform/blob/BlobURL.h"
36 37
37 namespace WebCore { 38 namespace WebCore {
38 39
39 namespace { 40 namespace {
40 41
41 class BlobURLRegistry FINAL : public URLRegistry { 42 class BlobURLRegistry FINAL : public URLRegistry {
42 public: 43 public:
43 virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) OVER RIDE; 44 virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) OVER RIDE;
(...skipping 14 matching lines...) Expand all
58 } 59 }
59 60
60 URLRegistry& BlobURLRegistry::registry() 61 URLRegistry& BlobURLRegistry::registry()
61 { 62 {
62 DEFINE_STATIC_LOCAL(BlobURLRegistry, instance, ()); 63 DEFINE_STATIC_LOCAL(BlobURLRegistry, instance, ());
63 return instance; 64 return instance;
64 } 65 }
65 66
66 } // namespace 67 } // namespace
67 68
69 DEFINE_GC_INFO(Blob);
70
68 Blob::Blob(PassRefPtr<BlobDataHandle> dataHandle) 71 Blob::Blob(PassRefPtr<BlobDataHandle> dataHandle)
69 : m_blobDataHandle(dataHandle) 72 : m_blobDataHandle(dataHandle)
70 { 73 {
71 ScriptWrappable::init(this); 74 ScriptWrappable::init(this);
72 } 75 }
73 76
74 Blob::~Blob() 77 Blob::~Blob()
75 { 78 {
76 } 79 }
77 80
(...skipping 14 matching lines...) Expand all
92 end = 0; 95 end = 0;
93 if (start >= size) { 96 if (start >= size) {
94 start = 0; 97 start = 0;
95 end = 0; 98 end = 0;
96 } else if (end < start) 99 } else if (end < start)
97 end = start; 100 end = start;
98 else if (end > size) 101 else if (end > size)
99 end = size; 102 end = size;
100 } 103 }
101 104
102 PassRefPtr<Blob> Blob::slice(long long start, long long end, const String& conte ntType) const 105 PassRefPtrWillBeRawPtr<Blob> Blob::slice(long long start, long long end, const S tring& contentType) const
103 { 106 {
104 long long size = this->size(); 107 long long size = this->size();
105 clampSliceOffsets(size, start, end); 108 clampSliceOffsets(size, start, end);
106 109
107 long long length = end - start; 110 long long length = end - start;
108 OwnPtr<BlobData> blobData = BlobData::create(); 111 OwnPtr<BlobData> blobData = BlobData::create();
109 blobData->setContentType(contentType); 112 blobData->setContentType(contentType);
110 blobData->appendBlob(m_blobDataHandle, start, length); 113 blobData->appendBlob(m_blobDataHandle, start, length);
111 return Blob::create(BlobDataHandle::create(blobData.release(), length)); 114 return Blob::create(BlobDataHandle::create(blobData.release(), length));
112 } 115 }
113 116
114 void Blob::appendTo(BlobData& blobData) const 117 void Blob::appendTo(BlobData& blobData) const
115 { 118 {
116 blobData.appendBlob(m_blobDataHandle, 0, m_blobDataHandle->size()); 119 blobData.appendBlob(m_blobDataHandle, 0, m_blobDataHandle->size());
117 } 120 }
118 121
119 URLRegistry& Blob::registry() const 122 URLRegistry& Blob::registry() const
120 { 123 {
121 return BlobURLRegistry::registry(); 124 return BlobURLRegistry::registry();
122 } 125 }
123 126
124
125 } // namespace WebCore 127 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698