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

Side by Side Diff: Source/modules/serviceworkers/RequestInit.cpp

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 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/core/dom/Node.cpp ('k') | Source/modules/serviceworkers/RespondWithObserver.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "RequestInit.h" 6 #include "RequestInit.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "bindings/core/v8/V8Blob.h" 10 #include "bindings/core/v8/V8Blob.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 DictionaryHelper::get(options, "mode", mode); 29 DictionaryHelper::get(options, "mode", mode);
30 DictionaryHelper::get(options, "credentials", credentials); 30 DictionaryHelper::get(options, "credentials", credentials);
31 31
32 v8::Local<v8::Value> body; 32 v8::Local<v8::Value> body;
33 if (!DictionaryHelper::get(options, "body", body) || body->IsUndefined() || body->IsNull()) 33 if (!DictionaryHelper::get(options, "body", body) || body->IsUndefined() || body->IsNull())
34 return; 34 return;
35 OwnPtr<BlobData> blobData = BlobData::create(); 35 OwnPtr<BlobData> blobData = BlobData::create();
36 v8::Isolate* isolate = toIsolate(context); 36 v8::Isolate* isolate = toIsolate(context);
37 if (body->IsArrayBuffer()) { 37 if (body->IsArrayBuffer()) {
38 ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(v8::Handle<v8::Object >::Cast(body)); 38 ArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Handle<v8::Object>: :Cast(body));
39 ASSERT(arrayBuffer); 39 ASSERT(arrayBuffer);
40 blobData->appendArrayBuffer(arrayBuffer); 40 blobData->appendArrayBuffer(arrayBuffer);
41 } else if (body->IsArrayBufferView()) { 41 } else if (body->IsArrayBufferView()) {
42 ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handl e<v8::Object>::Cast(body)); 42 ArrayBufferView* arrayBufferView = V8ArrayBufferView::toImpl(v8::Handle< v8::Object>::Cast(body));
43 ASSERT(arrayBufferView); 43 ASSERT(arrayBufferView);
44 blobData->appendArrayBufferView(arrayBufferView); 44 blobData->appendArrayBufferView(arrayBufferView);
45 } else if (V8Blob::hasInstance(body, isolate)) { 45 } else if (V8Blob::hasInstance(body, isolate)) {
46 Blob* blob = V8Blob::toNative(v8::Handle<v8::Object>::Cast(body)); 46 Blob* blob = V8Blob::toImpl(v8::Handle<v8::Object>::Cast(body));
47 ASSERT(blob); 47 ASSERT(blob);
48 blob->appendTo(*blobData); 48 blob->appendTo(*blobData);
49 blobData->setContentType(blob->type()); 49 blobData->setContentType(blob->type());
50 } else if (V8FormData::hasInstance(body, isolate)) { 50 } else if (V8FormData::hasInstance(body, isolate)) {
51 DOMFormData* domFormData = V8FormData::toNative(v8::Handle<v8::Object>:: Cast(body)); 51 DOMFormData* domFormData = V8FormData::toImpl(v8::Handle<v8::Object>::Ca st(body));
52 ASSERT(domFormData); 52 ASSERT(domFormData);
53 RefPtr<FormData> httpBody = domFormData->createMultiPartFormData(); 53 RefPtr<FormData> httpBody = domFormData->createMultiPartFormData();
54 for (size_t i = 0; i < httpBody->elements().size(); ++i) { 54 for (size_t i = 0; i < httpBody->elements().size(); ++i) {
55 const FormDataElement& element = httpBody->elements()[i]; 55 const FormDataElement& element = httpBody->elements()[i];
56 switch (element.m_type) { 56 switch (element.m_type) {
57 case FormDataElement::data: { 57 case FormDataElement::data: {
58 RefPtr<RawData> rawData = RawData::create(); 58 RefPtr<RawData> rawData = RawData::create();
59 rawData->mutableData()->append(element.m_data.data(), element.m_ data.size()); 59 rawData->mutableData()->append(element.m_data.data(), element.m_ data.size());
60 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile); 60 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile);
61 break; 61 break;
(...skipping 18 matching lines...) Expand all
80 blobData->appendText(stringValue, false); 80 blobData->appendText(stringValue, false);
81 blobData->setContentType("text/plain;charset=UTF-8"); 81 blobData->setContentType("text/plain;charset=UTF-8");
82 } else { 82 } else {
83 return; 83 return;
84 } 84 }
85 const long long blobSize = blobData->length(); 85 const long long blobSize = blobData->length();
86 bodyBlobHandle = BlobDataHandle::create(blobData.release(), blobSize); 86 bodyBlobHandle = BlobDataHandle::create(blobData.release(), blobSize);
87 } 87 }
88 88
89 } 89 }
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/modules/serviceworkers/RespondWithObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698