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

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

Issue 337343002: IDL: make optional arguments (without default) explicit sometimes Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-default-arguments-next
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/core/fileapi/Blob.h ('k') | Source/core/fileapi/File.h » ('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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 end = 0; 99 end = 0;
100 if (start >= size) { 100 if (start >= size) {
101 start = 0; 101 start = 0;
102 end = 0; 102 end = 0;
103 } else if (end < start) 103 } else if (end < start)
104 end = start; 104 end = start;
105 else if (end > size) 105 else if (end > size)
106 end = size; 106 end = size;
107 } 107 }
108 108
109 PassRefPtrWillBeRawPtr<Blob> Blob::slice(long long start, long long end, const S tring& contentType, ExceptionState& exceptionState) const 109 PassRefPtrWillBeRawPtr<Blob> Blob::slice(long long start, Optional<long long> op tionalEnd, const String& contentType, ExceptionState& exceptionState) const
110 { 110 {
111 if (hasBeenClosed()) { 111 if (hasBeenClosed()) {
112 exceptionState.throwDOMException(InvalidStateError, "Blob has been close d."); 112 exceptionState.throwDOMException(InvalidStateError, "Blob has been close d.");
113 return nullptr; 113 return nullptr;
114 } 114 }
115 115
116 long long end = optionalEnd.isMissing() ? std::numeric_limits<long long>::ma x() : optionalEnd.get();
117
116 long long size = this->size(); 118 long long size = this->size();
117 clampSliceOffsets(size, start, end); 119 clampSliceOffsets(size, start, end);
118 120
119 long long length = end - start; 121 long long length = end - start;
120 OwnPtr<BlobData> blobData = BlobData::create(); 122 OwnPtr<BlobData> blobData = BlobData::create();
121 blobData->setContentType(contentType); 123 blobData->setContentType(contentType);
122 blobData->appendBlob(m_blobDataHandle, start, length); 124 blobData->appendBlob(m_blobDataHandle, start, length);
123 return Blob::create(BlobDataHandle::create(blobData.release(), length)); 125 return Blob::create(BlobDataHandle::create(blobData.release(), length));
124 } 126 }
125 127
(...skipping 23 matching lines...) Expand all
149 { 151 {
150 blobData.appendBlob(m_blobDataHandle, 0, m_blobDataHandle->size()); 152 blobData.appendBlob(m_blobDataHandle, 0, m_blobDataHandle->size());
151 } 153 }
152 154
153 URLRegistry& Blob::registry() const 155 URLRegistry& Blob::registry() const
154 { 156 {
155 return BlobURLRegistry::registry(); 157 return BlobURLRegistry::registry();
156 } 158 }
157 159
158 } // namespace blink 160 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/Blob.h ('k') | Source/core/fileapi/File.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698