| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 void serialize(ResourceRequest& request) const override { | 119 void serialize(ResourceRequest& request) const override { |
| 120 DCHECK(m_data); | 120 DCHECK(m_data); |
| 121 | 121 |
| 122 RefPtr<EncodedFormData> entityBody = EncodedFormData::create(); | 122 RefPtr<EncodedFormData> entityBody = EncodedFormData::create(); |
| 123 if (m_data->hasBackingFile()) | 123 if (m_data->hasBackingFile()) |
| 124 entityBody->appendFile(toFile(m_data)->path()); | 124 entityBody->appendFile(toFile(m_data)->path()); |
| 125 else | 125 else |
| 126 entityBody->appendBlob(m_data->uuid(), m_data->blobDataHandle()); | 126 entityBody->appendBlob(m_data->uuid(), m_data->blobDataHandle()); |
| 127 | 127 |
| 128 request.setHTTPBody(entityBody.release()); | 128 request.setHTTPBody(std::move(entityBody)); |
| 129 | 129 |
| 130 if (!m_contentType.isEmpty()) | 130 if (!m_contentType.isEmpty()) |
| 131 request.setHTTPContentType(m_contentType); | 131 request.setHTTPContentType(m_contentType); |
| 132 } | 132 } |
| 133 | 133 |
| 134 const AtomicString getContentType() const { return m_contentType; } | 134 const AtomicString getContentType() const { return m_contentType; } |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 const Member<Blob> m_data; | 137 const Member<Blob> m_data; |
| 138 AtomicString m_contentType; | 138 AtomicString m_contentType; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 class BeaconDOMArrayBufferView final : public Beacon { | 141 class BeaconDOMArrayBufferView final : public Beacon { |
| 142 public: | 142 public: |
| 143 explicit BeaconDOMArrayBufferView(DOMArrayBufferView* data) : m_data(data) {} | 143 explicit BeaconDOMArrayBufferView(DOMArrayBufferView* data) : m_data(data) {} |
| 144 | 144 |
| 145 unsigned long long size() const override { return m_data->byteLength(); } | 145 unsigned long long size() const override { return m_data->byteLength(); } |
| 146 | 146 |
| 147 void serialize(ResourceRequest& request) const override { | 147 void serialize(ResourceRequest& request) const override { |
| 148 DCHECK(m_data); | 148 DCHECK(m_data); |
| 149 | 149 |
| 150 RefPtr<EncodedFormData> entityBody = | 150 RefPtr<EncodedFormData> entityBody = |
| 151 EncodedFormData::create(m_data->baseAddress(), m_data->byteLength()); | 151 EncodedFormData::create(m_data->baseAddress(), m_data->byteLength()); |
| 152 request.setHTTPBody(entityBody.release()); | 152 request.setHTTPBody(std::move(entityBody)); |
| 153 | 153 |
| 154 // FIXME: a reasonable choice, but not in the spec; should it give a | 154 // FIXME: a reasonable choice, but not in the spec; should it give a |
| 155 // default? | 155 // default? |
| 156 request.setHTTPContentType(AtomicString("application/octet-stream")); | 156 request.setHTTPContentType(AtomicString("application/octet-stream")); |
| 157 } | 157 } |
| 158 | 158 |
| 159 const AtomicString getContentType() const { return nullAtom; } | 159 const AtomicString getContentType() const { return nullAtom; } |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 const Member<DOMArrayBufferView> m_data; | 162 const Member<DOMArrayBufferView> m_data; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 bool PingLoader::sendBeacon(LocalFrame* frame, | 560 bool PingLoader::sendBeacon(LocalFrame* frame, |
| 561 int allowance, | 561 int allowance, |
| 562 const KURL& beaconURL, | 562 const KURL& beaconURL, |
| 563 Blob* data, | 563 Blob* data, |
| 564 int& payloadLength) { | 564 int& payloadLength) { |
| 565 BeaconBlob beacon(data); | 565 BeaconBlob beacon(data); |
| 566 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); | 566 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace blink | 569 } // namespace blink |
| OLD | NEW |